diff --git a/apps/maarch_entreprise/Views/action-administration.component.html b/apps/maarch_entreprise/Views/action-administration.component.html index ce0c72ca7139a3fe1de6e7bf678b3dae23fb8606..855d0c50537452d6d4a4c4f91100ef872c92d4c4 100755 --- a/apps/maarch_entreprise/Views/action-administration.component.html +++ b/apps/maarch_entreprise/Views/action-administration.component.html @@ -17,14 +17,13 @@ <form class="form-horizontal" (ngSubmit)="onSubmit()" #actionsFormUp="ngForm"> <div class="form-group"> <mat-form-field> - <input matInput [(ngModel)]="action.label_action" required name="action_name" id="action_name" title="{{lang.description}}" - type="text" placeholder="{{lang.description}}" required> + <input matInput [(ngModel)]="action.label_action" required name="action_name" id="action_name" title="{{lang.actionName}}" + type="text" placeholder="{{lang.actionName}}" maxlength="255"> </mat-form-field> </div> <div class="form-group"> <mat-form-field> - <mat-select id="status" name="status" title="{{lang.associatedStatus}}" placeholder="{{lang.associatedStatus}}" [(ngModel)]="action.id_status" - required> + <mat-select id="status" name="status" title="{{lang.associatedStatus}}" placeholder="{{lang.associatedStatus}}" [(ngModel)]="action.id_status" required> <mat-option *ngFor="let status of statuses" [value]="status.id"> {{status.label_status}} </mat-option> @@ -33,8 +32,7 @@ </div> <div class="form-group"> <mat-form-field> - <mat-select id="action_page" name="action_page" title="{{lang.actionPage}}" placeholder="{{lang.actionPage}}" [(ngModel)]="action.action_page" - required> + <mat-select id="action_page" name="action_page" title="{{lang.actionPage}}" placeholder="{{lang.actionPage}}" [(ngModel)]="action.action_page" > <mat-option *ngFor="let action of actionPagesList.actionsPageList" [value]="action.name"> {{action.label}} </mat-option> diff --git a/apps/maarch_entreprise/Views/actions-administration.component.html b/apps/maarch_entreprise/Views/actions-administration.component.html index 814154ec09fc73074df352cec7720918cf5f9091..0e7717f90096a087028b976733c867ecfc7af71d 100755 --- a/apps/maarch_entreprise/Views/actions-administration.component.html +++ b/apps/maarch_entreprise/Views/actions-administration.component.html @@ -30,7 +30,7 @@ <mat-cell *matCellDef="let element"> {{element.id}} </mat-cell> </ng-container> <ng-container matColumnDef="label_action"> - <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.description}}</mat-header-cell> + <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.actionName}}</mat-header-cell> <mat-cell *matCellDef="let element"> {{element.label_action}} </mat-cell> </ng-container> <ng-container matColumnDef="history"> diff --git a/apps/maarch_entreprise/Views/reports-administration.component.html b/apps/maarch_entreprise/Views/reports-administration.component.html index 65aec96f487ff8d06659c59eac8912cba218fc96..5fb9ce52feed88fb099599b70cd9c196ad9785f3 100644 --- a/apps/maarch_entreprise/Views/reports-administration.component.html +++ b/apps/maarch_entreprise/Views/reports-administration.component.html @@ -1,17 +1,10 @@ +<div class="page-header"> + <h1>{{lang.administration}} {{lang.reports}}</h1> +</div> <div *ngIf="loading"> - <i class="fa fa-spinner fa-spin fa-5x" style="margin-left: 50%;margin-top: 16%;font-size: 8em"></i> + <mat-spinner style="margin:auto;"></mat-spinner> </div> <div *ngIf="!loading" class="container-fluid"> - <h1 style="margin-top: 0"><i class="fa fa-area-chart fa-2x"></i> {{lang.reports}}</h1> - <nav class="navbar navbar-default" style="font-size:17px !important;" id="toolBox"> - <div class="container-fluid"> - <div class="navbar-header"> - <a class="navbar-brand" routerLink="/administration" style="cursor: pointer"> - <i class="fa fa-arrow-circle-left" title="{{lang.back}}"></i> - </a> - </div> - </div> - </nav> <div> <mat-select placeholder="{{lang.chooseGroup}}" [(ngModel)]="selectedGroup" (change)="loadReports()" name="group"> <mat-option *ngFor="let group of groups" [value]="group.group_id"> @@ -41,6 +34,7 @@ <div class="form-group"> <div style="text-align:center;"> <button type="submit" class="btn btn-success">{{lang.save}}</button> + <button mat-raised-button routerLink='/administration'>{{lang.cancel}}</button> </div> </div> </form> diff --git a/apps/maarch_entreprise/Views/status-administration.component.html b/apps/maarch_entreprise/Views/status-administration.component.html index 60172bb914437e35dbb3fccee0f92c7b283697c9..f2d65bba6a2a7d3eac83afa3d34f9859553430ec 100755 --- a/apps/maarch_entreprise/Views/status-administration.component.html +++ b/apps/maarch_entreprise/Views/status-administration.component.html @@ -18,7 +18,7 @@ <div class="form-group"> <div class="col-sm-12"> <mat-form-field> - <input matInput name="label_status" id="label_status" maxlength="50" [(ngModel)]="status.label_status" title="{{lang.description}}" placeholder="{{lang.description}}" type="text" required> + <input matInput name="label_status" id="label_status" maxlength="50" [(ngModel)]="status.label_status" title="{{lang.statusName}}" placeholder="{{lang.statusName}}" type="text" required> </mat-form-field> </div> </div> diff --git a/apps/maarch_entreprise/Views/statuses-administration.component.html b/apps/maarch_entreprise/Views/statuses-administration.component.html index db9ab7b9618df6849cad5a37df7b438e47dcebd8..360bff070c45ddfba6cec61ef65e792521c47fdf 100755 --- a/apps/maarch_entreprise/Views/statuses-administration.component.html +++ b/apps/maarch_entreprise/Views/statuses-administration.component.html @@ -37,7 +37,7 @@ <mat-cell *matCellDef="let element"> {{element.id}} </mat-cell> </ng-container> <ng-container matColumnDef="label_status"> - <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.description}}</mat-header-cell> + <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.statusName}}</mat-header-cell> <mat-cell *matCellDef="let element"> {{element.label_status}} </mat-cell> </ng-container> <ng-container matColumnDef="identifier"> diff --git a/apps/maarch_entreprise/admin/action/action_list_by_name.php b/apps/maarch_entreprise/admin/action/action_list_by_name.php deleted file mode 100755 index 445121b960559d638b4415e24a5eea389120161a..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/action/action_list_by_name.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php -/* -* Copyright 2008,2009 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Script used by an ajax autocompleter object to get actions list -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup admin -*/ - -$db = new Database(); -$stmt = $db->query('SELECT label_action as tag FROM ' - . $_SESSION['tablename']['actions'] . " WHERE lower(label_action) like lower(?) order by label_action", - array('%'.$_REQUEST['what'].'%') - ); - - -$listArray = array(); -while($line = $stmt->fetchObject()){ - array_push($listArray, $line->tag); -} -echo "<ul>\n"; -$authViewList = 0; - -foreach($listArray as $what){ - if($authViewList >= 10){ - $flagAuthView = true; - } - echo "<li>".functions::xssafe($what)."</li>\n"; - if(isset($flagAuthView) && $flagAuthView){ - echo "<li>...</li>\n"; - break; - } - $authViewList++; -} -echo "</ul>"; diff --git a/apps/maarch_entreprise/admin/action/action_management.php b/apps/maarch_entreprise/admin/action/action_management.php deleted file mode 100755 index be27e03d25f24a2403275c97be003a0f8c7de597..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/action/action_management.php +++ /dev/null @@ -1,282 +0,0 @@ -<?php - -/* Affichage */ -if($mode == 'list'){ - list_show::admin_list($tab, $i, $title, 'id', - 'action_management_controler&mode=list','action','id', true, - $page_name_up, $page_name_val, $page_name_ban, $page_name_del, - $page_name_add, $label_add, FALSE, FALSE, _ALL_ACTIONS, _ACTION, - 'exchange', false, true, false, true, - $what, true, $autoCompletionArray - ); -} -elseif($mode == 'up' || $mode == 'add'){ - ?><h1><i class="fa fa-exchange fa-2x"></i> - <?php - if($mode == 'up'){ - echo _MODIFY_ACTION; - } - elseif($mode == 'add'){ - echo _ADD_ACTION; - } - ?> - </h1> - <div id="inner_content" class="clearfix" align="center"> - <br /><br /> - <?php - if($state == false){ - echo '<br /><br /><br /><br />' . _THE_ACTION . ' ' . _UNKNOWN - . '<br /><br /><br /><br />'; - } - else{?> - <div class="block"> - <form name="frmaction" id="frmaction" method="post" action="<?php - echo $_SESSION['config']['businessappurl'] . 'index.php?' - . 'page=action_management_controler&admin=action&mode=' . $mode . '&id=' . $_REQUEST['id']; - ?>" class="forms addforms"> - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="admin" value="action" /> - <input type="hidden" name="page" value="action_management_controler" /> - <input type="hidden" name="mode" value="<?php echo $mode;?>" /> - - <input type="hidden" name="order" id="order" value="<?php - functions::xecho($_REQUEST['order']);?>" /> - <input type="hidden" name="order_field" id="order_field" value="<?php - functions::xecho($_REQUEST['order_field']);?>" /> - <input type="hidden" name="what" id="what" value="<?php - functions::xecho($_REQUEST['what']);?>" /> - <input type="hidden" name="start" id="start" value="<?php - functions::xecho($_REQUEST['start']);?>" /> - - <p> - <label for="label"><?php echo _DESC;?> : </label> - <input name="label" type="text" id="label" value="<?php - functions::xecho(functions::show_str($_SESSION['m_admin']['action']['LABEL']));?>"/> - </p> - <?php - if($_SESSION['m_admin']['action']['IS_SYSTEM'] == 'Y'){ - echo '<div class="error">' . _DO_NOT_MODIFY_UNLESS_EXPERT - . '</div><br/>'; - }?> - <p> - <label for="status"><?php echo _ASSOCIATED_STATUS;?> : </label> - <select name="status" id="status"> - <option value="_NOSTATUS_"><?php echo _CHOOSE_STATUS;?></option> - <option value="_NOSTATUS_"><?php echo _UNCHANGED;?></option> - <?php - for($i = 0; $i < count($statusArray); $i++){ - ?><option value="<?php functions::xecho($statusArray[$i]['id']);?>" - <?php - if($_SESSION['m_admin']['action']['ID_STATUS'] - == $statusArray[$i]['id']) { - echo 'selected="selected"'; - }?>><?php functions::xecho($statusArray[$i]['label']); - ?></option><?php - } - ?> - </select> - </p> - <p> - <label for="action_page"><?php echo _ACTION_PAGE;?> : </label> - <?php - foreach ($_SESSION['actions_pages'] as $key => $value) { - $array_actions['ID']=$value['ID']; - $array_actions['LABEL']=$value['LABEL']; - $action_tri[$value['MODULE']][]=$array_actions; - } - ?> - <select name="action_page" id="action_page"> - <option value="_"><?php echo _NO_PAGE;?></option> - <?php - foreach ($action_tri as $module_name => $actions_ids) { - if($module_name == ''){ - echo '<optgroup label="Apps">'; - foreach ($actions_ids as $key => $action_id) { - ?><option value="<?php - functions::xecho($action_id['ID']);?>" <?php - if($action_id['ID'] == $_SESSION['m_admin']['action']['ACTION_PAGE']){ - echo 'selected="selected"'; - } ?> ><?php - - functions::xecho($action_id['LABEL']); - ?></option><?php - } - echo '</optgroup>'; - }else{ - echo '<optgroup label="'.ucfirst($module_name).'">'; - foreach ($actions_ids as $key => $action_id) { - ?><option value="<?php - functions::xecho($action_id['ID']);?>" <?php - if($action_id['ID'] - == $_SESSION['m_admin']['action']['ACTION_PAGE']){ - echo 'selected="selected"'; - }?> ><?php - functions::xecho($action_id['LABEL']); - ?></option><?php - } - echo '</optgroup>'; - } - } - ?> - <?php - /*for($i = 0; $i < count($_SESSION['actions_pages']); $i++){ - ?><option value="<?php - functions::xecho($_SESSION['actions_pages'][$i]['ID']);?>" <?php - if($_SESSION['actions_pages'][$i]['ID'] - == $_SESSION['m_admin']['action']['ACTION_PAGE']){ - echo 'selected="selected"'; - }?> ><?php - functions::xecho($_SESSION['actions_pages'][$i]['LABEL']); - ?></option><?php - }*/?> - </select> - </p> - <p> - <label for="keyword"><?php echo _KEYWORD.' ('._SYSTEM_PARAMETERS.')';?>:</label> - <select name="keyword" id="keyword"> - <option value=" "><?php echo _NO_KEYWORD;?></option> - <option value="redirect" <?php if($_SESSION['m_admin']['action']['KEYWORD'] == 'redirect'){ echo 'selected="selected"';}?>><?php echo _REDIRECT;?></option> - <option value="to_validate" <?php if($_SESSION['m_admin']['action']['KEYWORD'] == 'to_validate'){ echo 'selected="selected"';}?>><?php echo _TO_VALIDATE;?></option> - <option value="indexing" <?php if($_SESSION['m_admin']['action']['KEYWORD'] == 'indexing'){ echo 'selected="selected"';}?>><?php echo _INDEXING;?></option> - <option value="workflow" <?php if($_SESSION['m_admin']['action']['KEYWORD'] == 'workflow'){ echo 'selected="selected"';}?>><?php echo _WF;?></option> - </select> - </p> - <p> - <label for="history"><?php echo _ACTION_HISTORY;?> : </label> - <input type="radio" class="check" name="history" value="Y" <?php - if($_SESSION['m_admin']['action']['HISTORY'] == 'Y'){ - echo 'checked="checked"'; - }?> /><?php echo _YES;?> - <input type="radio" class="check" name="history" value="N" <?php - if($_SESSION['m_admin']['action']['HISTORY'] == 'N'){ - echo 'checked="checked"'; - }?>/><?php echo _NO;?> - </p> - <?php - $core_tools = new core_tools(); - if ($core_tools->is_module_loaded('folder')) { - ?> - <p> - <label ><?php echo _IS_FOLDER_ACTION;?> : </label> - <input type="radio" class="check" name="is_folder_action" value="Y" - <?php - if ($_SESSION['m_admin']['action']['IS_FOLDER_ACTION'] == 'Y') { - ?> checked="checked"<?php - } ?> /><?php echo _YES;?> - <input type="radio" name="is_folder_action" class="check" value="N" - <?php - if ($_SESSION['m_admin']['action']['IS_FOLDER_ACTION'] == 'N') { - ?> checked="checked"<?php - } ?> /><?php echo _NO;?> - </p> - <?php }else{ - - echo '<input type="hidden" name="is_folder_action" value="N"'; - } ?> - <table align="center" width="100%" id="categories_association" > - <tr> - <td colspan="3"><?php echo _CHOOSE_CATEGORY_ASSOCIATION;?> : <br /> <small>(<?php echo _CHOOSE_CATEGORY_ASSOCIATION_HELP;?>)<small></td> - </tr> - <tr> - <td width="40%" align="center"> - <select name="categorieslist[]" id="categorieslist" size="7" - ondblclick='moveclick($(categorieslist), $(categories_chosen));' multiple="multiple" > - <?php - foreach ($_SESSION['coll_categories'] as $collId => $collLabel) { - if(!preg_match('/attachments/', $collId)){ - $state_category = false; - foreach ($collLabel as $catId => $catValue) { - $j=0; - $state_category = false; - if ($catId <> 'default_category') { - for ($j=0;$j<count($_SESSION['m_admin']['action']['categories']);$j++) { - if ($catId == $_SESSION['m_admin']['action']['categories'][$j]) { - $state_category = true; - } - } - if ($state_category == false) { - ?> - <option value="<?php - functions::xecho($catId); - ?>"><?php - functions::xecho($catValue); - //functions::xecho($collId . ' / ' . $catValue); - ?></option> - <?php - } - } - } - } - - } - ?> - </select> - <br/> - </td> - <td width="20%" align="center"> - <input type="button" class="button" value="<?php - echo _ADD; - ?> >>" onclick='Move($(categorieslist), $(categories_chosen));' /> - <br /> - <br /> - <input type="button" class="button" value="<< <?php - echo _REMOVE; - ?>" onclick='Move($(categories_chosen), $(categorieslist));' /> - </td> - <td width="40%" align="center"> - <select name="categories_chosen[]" id="categories_chosen" size="7" - ondblclick='moveclick($(categories_chosen), $(categorieslist));' multiple="multiple"> - <?php - foreach ($_SESSION['coll_categories'] as $collId => $collLabel) { - if(!preg_match('/attachments/', $collId)){ - $state_category = false; - foreach ($collLabel as $catId => $catValue) { - $j=0; - $state_category = false; - if ($catId <> 'default_category') { - for ($j=0;$j<count($_SESSION['m_admin']['action']['categories']);$j++) { - if ($catId == $_SESSION['m_admin']['action']['categories'][$j]) { - $state_category = true; - } - } - if ($state_category == true) { - ?> - <option value="<?php - functions::xecho($catId); - ?>" selected="selected"><?php - functions::xecho($catValue); - //functions::xecho($collId . ' / ' . $catValue); - ?></option> - <?php - } - } - } - } - - } - ?> - </select> - <br/> - <!--<em><a href="javascript:selectall($(categories_chosen));" > - <?php echo _SELECT_ALL;?></a></em>--> - </td> - </tr> - </table> - - <p class="buttons"> - - <input type="submit" class="button" name="action_submit" onclick ="javascript:selectall($(categories_chosen));" value="<?php - echo _VALIDATE;?>" /> - - <input type="button" class="button" name="cancel" value="<?php - echo _CANCEL;?>" onclick="javascript:window.location.href='<?php - echo $_SESSION['config']['businessappurl']; - ?>index.php?page=action_management_controler&mode=list&admin=action';"/> - </p> - </form > - <div class="infos"><?php echo _INFOS_ACTIONS;?></div> - </div> - </div> - <?php - } -} diff --git a/apps/maarch_entreprise/admin/action/action_management_controler.php b/apps/maarch_entreprise/admin/action/action_management_controler.php deleted file mode 100755 index 6770289bcdcc310150e4c62fba0d32dd1e5b46a7..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/action/action_management_controler.php +++ /dev/null @@ -1,422 +0,0 @@ -<?php - -/* -* Copyright 2008-2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the action controler page -* -* -* @file -* @author Laurent Giovannoni -* @author Arnaud Veber -* @date $date$ -* @version $Revision$ -* @ingroup admin -*/ - -$core_tools = new core_tools(); -$core_tools->test_admin('admin_actions', 'apps'); - -core_tools::load_lang(); - -$mode = 'add'; -if (isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) { - $mode = $_REQUEST['mode']; -} - -$page_labels = array( - 'add' => _ADDITION, - 'up' => _MODIFICATION, - 'list' => _ACTION_LIST -); -$page_ids = array( - 'add' => 'action_add', - 'up' => 'action_up', - 'list' => 'action_list' -); - -try { - require_once('core/class/ActionControler.php'); - require_once('core/class/class_request.php'); - if ($mode == 'list') { - require_once('apps' . DIRECTORY_SEPARATOR - . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'class' - . DIRECTORY_SEPARATOR . 'class_list_show.php'); - } - require_once 'core/class/StatusControler.php'; -} catch (Exception $e) { - functions::xecho($e->getMessage()); -} - -$statusController = new Maarch_Core_Class_StatusControler(); - -if ($mode == "up" || $mode == "add") { - $statusArray = array(); - $statusArray = $statusController->getAllInfos(); -} - -function init_session() -{ - $_SESSION['m_admin']['action'] = array(); - $_SESSION['m_admin']['action']['ID'] = ''; - $_SESSION['m_admin']['action']['LABEL'] = ''; - $_SESSION['m_admin']['action']['ID_STATUS'] = ''; - $_SESSION['m_admin']['action']['ACTION_PAGE'] = ''; - $_SESSION['m_admin']['action']['KEYWORD'] = ''; - $_SESSION['m_admin']['action']['HISTORY'] = 'Y'; - $_SESSION['m_admin']['action']['IS_FOLDER_ACTION'] = 'N'; - $_SESSION['m_admin']['action']['categories'] = ''; - $_SESSION['m_admin']['action']['categoriesSelected'] = ''; -} - -if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { - $action_id = $_REQUEST['id']; -} - -if (isset($_REQUEST['action_submit'])) { - if ($_REQUEST['mode'] == 'up') { - $_SESSION['m_admin']['action']['ID'] = - functions::wash($action_id, 'no', _ID . ' '); - } - $_SESSION['m_admin']['action']['LABEL'] = - functions::wash($_REQUEST['label'], 'no', _DESC .' ', 'yes', 0, 255); - if (empty($_REQUEST['action_page'])) { - $_SESSION['m_admin']['action']['ID_STATUS'] = - functions::wash($_REQUEST['status'], 'no', _STATUS . ' ', 'yes', 0, - 10); - } else { - $_SESSION['m_admin']['action']['ID_STATUS'] = trim($_REQUEST['status']); - } - if (empty($_REQUEST['status'])) { - $_SESSION['m_admin']['action']['ID_STATUS'] = ' '; - $_SESSION['m_admin']['action']['ACTION_PAGE'] = - functions::wash($_REQUEST['action_page'], 'no', _ACTION_PAGE . ' ', - 'yes', 0, 255); - } else { - $_SESSION['m_admin']['action']['ACTION_PAGE'] = trim($_REQUEST['action_page']); - } - $_SESSION['m_admin']['action']['KEYWORD'] = $_REQUEST['keyword']; - //$_SESSION['m_admin']['action']['CATEGORY_ID'] = $_REQUEST['category_id']; - $_SESSION['m_admin']['action']['categoriesSelected'] = array(); - for ($i=0;$i<count($_REQUEST['categories_chosen']); $i++) { - array_push( - $_SESSION['m_admin']['action']['categoriesSelected'], - $_REQUEST['categories_chosen'][$i] - ); - } - $_SESSION['m_admin']['action']['FLAG_CREATE'] = 'N'; - - - $_SESSION['m_admin']['action']['HISTORY'] = - functions::wash($_REQUEST['history'], 'no', _HISTORY . ' '); - - $_SESSION['m_admin']['action']['IS_FOLDER_ACTION'] = - functions::wash($_REQUEST['is_folder_action'], 'no', _IS_FOLDER_ACTION . ' '); - - $_SESSION['m_admin']['action']['order'] = $_REQUEST['order']; - $_SESSION['m_admin']['action']['order_field'] = $_REQUEST['order_field']; - $_SESSION['m_admin']['action']['what'] = $_REQUEST['what']; - $_SESSION['m_admin']['action']['start'] = $_REQUEST['start']; - - if ($mode == 'add' - && ActionControler::actionExists($_SESSION['m_admin']['action']['ID']) - ) { - $_SESSION['error'] = $_SESSION['m_admin']['action']['ID'] . ' ' - . _ALREADY_EXISTS . '<br />'; - } - if (!empty($_SESSION['error'])) { - if ($mode == 'up') { - if (!empty($_SESSION['m_admin']['action']['ID'])) { - header('location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=action_management_controler&mode=up&id=' - . $_SESSION['m_admin']['action']['ID'] . '&admin=action' - ); - exit(); - } else { - header('location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=action_management_controler&mode=list' - . '&admin=action&order=' . $_REQUEST['order'] - . '&order_field=' . $_REQUEST['order_field'] . '&start=' - . $_REQUEST['start'] . '&what=' . $_REQUEST['what'] - ); - exit(); - } - } elseif ($mode == 'add') { - header('location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=action_management_controler&mode=add' - . '&admin=action' - ); - exit(); - } - } else { - $action_value = array( - 'id' => $_SESSION['m_admin']['action']['ID'], - 'label_action' => $_SESSION['m_admin']['action']['LABEL'], - 'keyword' => $_SESSION['m_admin']['action']['KEYWORD'], - 'create_id' => $_SESSION['m_admin']['action']['FLAG_CREATE'], - 'history' => $_SESSION['m_admin']['action']['HISTORY'], - 'is_folder_action' => $_SESSION['m_admin']['action']['IS_FOLDER_ACTION'], - 'action_page' => $_SESSION['m_admin']['action']['ACTION_PAGE'], - 'id_status' => $_SESSION['m_admin']['action']['ID_STATUS'], - //'category_id' => $_SESSION['m_admin']['action']['CATEGORY_ID'] - ); - - $action = new Action(); - $action->setArray($action_value); - - ActionControler::save($action, $mode); - if ($_SESSION['m_admin']['action']['ID'] == "") { - ActionControler::saveCategoriesAssociation(ActionControler::getLastActionId($_SESSION['m_admin']['action']['LABEL'])); - } else { - ActionControler::saveCategoriesAssociation($_SESSION['m_admin']['action']['ID']); - } - - ActionControler::razActionPage(); - - if ($_SESSION['history']['actionadd'] == 'true' && $mode == 'add') { - $db = new Database(); - $query = $db->limit_select(0, 1, "id", "actions", "", "ORDER BY id desc"); - $stmt = $db->query($query); - $last_insert = $stmt->fetchObject(); - - require_once('core/class/class_history.php'); - $hist = new history(); - $hist->add($_SESSION['tablename']['actions'], - $last_insert->id, 'ADD', 'actionadd', - _ACTION_ADDED . ' : ' . $last_insert->id, - $_SESSION['config']['databasetype'] - ); - } elseif ($_SESSION['history']['actionup'] == 'true' && $mode == 'up') { - require_once('core/class/class_history.php'); - $hist = new history(); - $hist->add($_SESSION['tablename']['actions'], - $_SESSION['m_admin']['action']['ID'], 'UP', 'actionup', _ACTION_MODIFIED - . ' : ' . $_SESSION['m_admin']['action']['ID'], - $_SESSION['config']['databasetype'] - ); - } - unset($_SESSION['m_admin']); - if($mode == 'add'){ - $_SESSION['info'] = _ACTION_ADDED; - } else { - $_SESSION['info'] = _ACTION_MODIFIED; - } - - header('location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=action_management_controler&mode=list' - . '&admin=action&order=' . $_REQUEST['order'] . '&order_field=' - . $_REQUEST['order_field'] . '&start=' . $_REQUEST['start'] - . '&what=' . $_REQUEST['what'] - ); - } - exit(); -} - -$state = true; - -if ($mode == 'up') { - $action = ActionControler::get($action_id); - $categories = ActionControler::getAllCategoriesLinkedToAction($action_id); - if (!isset($action)) { - $state = false; - } else { - $_SESSION['m_admin']['action']['ID'] = $action->__get('id'); - $_SESSION['m_admin']['action']['LABEL'] = - functions::show_string($action->__get('label_action')); - $_SESSION['m_admin']['action']['ID_STATUS'] = - functions::show_string($action->__get('id_status')); - $_SESSION['m_admin']['action']['IS_SYSTEM'] = - functions::show_string($action->__get('is_system')); - $_SESSION['m_admin']['action']['ACTION_PAGE'] = - functions::show_string($action->__get('action_page')); - $_SESSION['m_admin']['action']['HISTORY'] = - functions::show_string($action->__get('history')); - $_SESSION['m_admin']['action']['IS_FOLDER_ACTION'] = - functions::show_string($action->__get('is_folder_action')); - $_SESSION['m_admin']['action']['KEYWORD'] = - functions::show_string($action->__get('keyword')); - /*$_SESSION['m_admin']['action']['CATEGORY_ID'] = - functions::show_string($action->__get('category_id'));*/ - $_SESSION['m_admin']['action']['categories'] = $categories; - } -} elseif ($mode == 'add') { - if (!isset($_SESSION['m_admin']['action'])) { - init_session(); - } -} elseif ($mode == 'list') { - $_SESSION['m_admin'] = array(); - init_session(); - - $select[$_SESSION['tablename']['actions']] = array(); - array_push($select[$_SESSION['tablename']['actions']], 'id', 'label_action', - 'is_folder_action ', 'is_system' - ); - $what = ''; - $where = " enabled = 'Y' "; - $arrayPDO = array(); - if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) { - $what = $_REQUEST['what']; - $where .= " and (lower(label_action) like lower(?)) "; - $arrayPDO = array($what.'%'); - } - $order = 'asc'; - if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $order = trim($_REQUEST['order']); - } - $field = 'label_action'; - if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) { - $field = trim($_REQUEST['order_field']); - } - - $orderstr = list_show::define_order($order, $field); - $request = new request(); - $tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, - $_SESSION['config']['databasetype']); - for ($i = 0;$i < count($tab); $i++) { - for ($j = 0;$j < count($tab[$i]); $j++) { - foreach (array_keys($tab[$i][$j]) as $value) { - if ($tab[$i][$j][$value] == 'id') { - $load = core_tools::is_action_defined($tab[$i][$j]['value']); - - $tab[$i][$j]['id'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] = _ID; - $tab[$i][$j]['size'] = '10'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'id'; - } - if ($tab[$i][$j][$value] == 'label_action') { - $tab[$i][$j]['value'] = - functions::show_string($tab[$i][$j]['value']); - $tab[$i][$j]['label_action'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] = _DESC; - $tab[$i][$j]['size'] = '30'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'label_action'; - } - if ($tab[$i][$j][$value] == 'is_system') { - if ($tab[$i][$j]['value'] == 'Y') { - $tab[$i][$j]['value'] = _YES; - array_push($tab[$i], array('column' => 'can_delete', - 'value' => 'false', 'can_delete' => 'false', - 'label' => _DESC,'show' => false) - ); - } else { - $tab[$i][$j]['value'] = _NO; - array_push($tab[$i], array('column' => 'can_delete', - 'value' => 'true', 'can_delete' => 'true', - 'label' => _DESC,'show' => false) - ); - } - $tab[$i][$j]['is_system'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] =_IS_SYSTEM; - $tab[$i][$j]['size'] = '10'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'is_system'; - } - if (core_tools::is_module_loaded('folder')) { - if ($tab[$i][$j][$value] == 'is_folder_action') { - ($tab[$i][$j]['value'] == 'Y')? $tab[$i][$j]['value'] = _YES : $tab[$i][$j]['value'] = _NO; - $tab[$i][$j]['is_system'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] =_IS_FOLDER_ACTION; - $tab[$i][$j]['size'] = '10'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'is_system'; - } - } - } - } - } - - $page_name = 'action_management_controler&mode=list'; - $page_name_up = 'action_management_controler&mode=up'; - $page_name_del = 'action_management_controler&mode=del'; - $page_name_val = ''; - $page_name_ban = ''; - $page_name_add = 'action_management_controler&mode=add'; - $label_add = _ADD_ACTION; - $_SESSION['m_admin']['init'] = true; - $title = _ACTION_LIST . ' : ' . count($tab) . ' ' . _ACTIONS; - - $autoCompletionArray = array(); - $autoCompletionArray['list_script_url'] = - $_SESSION['config']['businessappurl'] .'index.php?display=true' - . '&admin=action&page=action_list_by_name'; - $autoCompletionArray['number_to_begin'] = 1; -} elseif ((!isset($action_id) || empty($action_id) - || ! ActionControler::actionExists($action_id)) - && $mode == 'del' -) { - $_SESSION['error'] = _ACTION.' '._UNKNOWN; -} elseif ($mode == 'del') { - ActionControler::delete($action_id); - $_SESSION['info'] = _ACTION_DELETED . ' ' . $action_id; - - if($_SESSION['history']['actiondel'] == 'true') { - require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_history.php'); - $hist = new history(); - $hist->add($_SESSION['tablename']['actions'], $action_id, "DEL", 'actiondel', _ACTION_DELETED.' : '.$action_id, $_SESSION['config']['databasetype']); - } - - ?><script type="text/javascript">window.top.location='<?php - echo $_SESSION['config']['businessappurl'] - . 'index.php?page=action_management_controler&mode=list&admin=action' - . '&order='.$_REQUEST['order'] . '&order_field=' - . $_REQUEST['order_field'] . '&start=' . $_REQUEST['start'] . '&what=' - . addslashes($_REQUEST['what']);?>';</script> - <?php - exit(); -} - -if ($mode == 'add' || $mode == 'up' || $mode == 'list') { - /****************Management of the location bar ************/ - $init = false; - if (isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == 'true') { - $init = true; - } - $level = ''; - if (isset($_REQUEST['level']) - && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 - || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) - ) { - $level = $_REQUEST['level']; - } - $page_path = $_SESSION['config']['businessappurl'] - . 'index.php?page=action_management_controler&admin=action&mode=' - . $mode; - $page_label = $page_labels[$mode]; - $page_id = $page_ids[$mode]; - core_tools::manage_location_bar($page_path, $page_label, $page_id, $init, - $level); - /***********************************************************/ - - include('action_management.php'); -} diff --git a/apps/maarch_entreprise/css/action-administration.component.css b/apps/maarch_entreprise/css/action-administration.component.css deleted file mode 100755 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/css/action-administration.component.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.js index 0f734998b34a19a0862694892bd5d96958dbf877..4a3dedf7f2ef074027cb2ee415a0db730a503e1d 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.js @@ -21,7 +21,6 @@ var ActionAdministrationComponent = /** @class */ (function () { this.router = router; this.notify = notify; this.lang = translate_component_1.LANG; - this._search = ''; this.action = {}; this.statuses = []; this.actionPagesList = []; @@ -75,9 +74,6 @@ var ActionAdministrationComponent = /** @class */ (function () { } }); }; - ActionAdministrationComponent.prototype.clearSearch = function () { - this._search = ''; - }; ActionAdministrationComponent.prototype.onSubmit = function () { var _this = this; if (this.creationMode) { @@ -102,7 +98,6 @@ var ActionAdministrationComponent = /** @class */ (function () { ActionAdministrationComponent = __decorate([ core_1.Component({ templateUrl: angularGlobals["action-administrationView"], - styleUrls: ['css/action-administration.component.css'], providers: [notification_service_1.NotificationService] }), __metadata("design:paramtypes", [http_1.HttpClient, router_1.ActivatedRoute, router_1.Router, notification_service_1.NotificationService]) diff --git a/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.ts index 8ac02c22dbcb4c003aab5b4ff4378992aa077c4e..17674a94436e4c0efaf45df1030ac29cbab90fde 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.ts @@ -11,12 +11,10 @@ declare var angularGlobals : any; @Component({ templateUrl : angularGlobals["action-administrationView"], - styleUrls : ['css/action-administration.component.css'], providers : [NotificationService] }) export class ActionAdministrationComponent implements OnInit { lang : any = LANG; - _search : string = ''; coreUrl : string; creationMode : boolean; action : any = {}; @@ -85,10 +83,6 @@ export class ActionAdministrationComponent implements OnInit { }); } - clearSearch(){ - this._search = ''; - } - onSubmit() { if (this.creationMode) { this.http.post(this.coreUrl + 'rest/actions', this.action) diff --git a/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.js index ba6a8c5cd8d64aaebf0382db87c440e4b28095ba..8a8697b55333849ef39514b3293ae6dd205e8d02 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.js @@ -83,7 +83,6 @@ var ActionsAdministrationComponent = /** @class */ (function () { ActionsAdministrationComponent = __decorate([ core_1.Component({ templateUrl: angularGlobals["actions-administrationView"], - styleUrls: [], providers: [notification_service_1.NotificationService] }), __metadata("design:paramtypes", [http_1.HttpClient, notification_service_1.NotificationService]) diff --git a/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts index ee92cc5a6494ef362ec7a175500aca58563c3098..b32bb11d707ed4abd37a41291f21b0ca7555ceb9 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts @@ -12,7 +12,6 @@ declare var angularGlobals : any; @Component({ templateUrl : angularGlobals["actions-administrationView"], - styleUrls : [], providers : [NotificationService] }) @@ -86,9 +85,3 @@ export class ActionsAdministrationComponent implements OnInit { } } } -export interface Action { - id: number; - label_action: string; - history: string; - is_folder_action: string; -} \ No newline at end of file diff --git a/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.js index 70fb9062c953e3195d4e81ab08abaea1a75f5b5b..e2a7b8e080bf8b119672b5694cae11a081e2c37e 100644 --- a/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.js @@ -104,7 +104,6 @@ var BasketAdministrationComponent = /** @class */ (function () { BasketAdministrationComponent = __decorate([ core_1.Component({ templateUrl: angularGlobals["basket-administrationView"], - styleUrls: ['../../node_modules/bootstrap/dist/css/bootstrap.min.css'], providers: [notification_service_1.NotificationService] }), __metadata("design:paramtypes", [http_1.HttpClient, router_1.ActivatedRoute, router_1.Router, notification_service_1.NotificationService]) diff --git a/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.ts index 54522ddc93099569f84380093e0e043f2a346ce2..682036e2416a1f139d518337cfc9e8075486aa7f 100644 --- a/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/basket-administration.component.ts @@ -11,7 +11,6 @@ declare var angularGlobals : any; @Component({ templateUrl : angularGlobals["basket-administrationView"], - styleUrls : ['../../node_modules/bootstrap/dist/css/bootstrap.min.css'], providers : [NotificationService] }) export class BasketAdministrationComponent implements OnInit { diff --git a/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.js index f2a3cf210f07b69ad6ed5a1bfb9c1271d92ab581..44f6048efa8802ebbe6f2c495fcf6acd936450bd 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.js @@ -12,13 +12,16 @@ Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = require("@angular/core"); var http_1 = require("@angular/common/http"); var translate_component_1 = require("../translate.component"); +var notification_service_1 = require("../notification.service"); var ReportsAdministrationComponent = /** @class */ (function () { - function ReportsAdministrationComponent(http) { + function ReportsAdministrationComponent(http, notify) { this.http = http; + this.notify = notify; this.lang = translate_component_1.LANG; this.groups = []; this.reports = []; this.selectedGroup = ""; + this.loading = false; } ReportsAdministrationComponent.prototype.updateBreadcrumb = function (applicationName) { if ($j('#ariane')[0]) { @@ -29,9 +32,13 @@ var ReportsAdministrationComponent = /** @class */ (function () { var _this = this; this.updateBreadcrumb(angularGlobals.applicationName); this.coreUrl = angularGlobals.coreUrl; - this.http.get(this.coreUrl + 'rest/groups') + this.loading = true; + this.http.get(this.coreUrl + 'rest/reports/groups') .subscribe(function (data) { _this.groups = data['groups']; + _this.loading = false; + }, function () { + location.href = "index.php"; }); }; ReportsAdministrationComponent.prototype.loadReports = function () { @@ -40,23 +47,24 @@ var ReportsAdministrationComponent = /** @class */ (function () { .subscribe(function (data) { _this.reports = data['reports']; }, function (err) { - errorNotification(err.error.errors); + _this.notify.error(err.error.errors); }); }; ReportsAdministrationComponent.prototype.onSubmit = function () { + var _this = this; this.http.put(this.coreUrl + 'rest/reports/groups/' + this.selectedGroup, this.reports) - .subscribe(function (data) { - successNotification(data['success']); + .subscribe(function () { + _this.notify.success(_this.lang.modificationSaved); }, function (err) { - errorNotification(err.error.errors); + _this.notify.error(err.error.errors); }); }; ReportsAdministrationComponent = __decorate([ core_1.Component({ templateUrl: angularGlobals["reports-administrationView"], - styleUrls: ['../../node_modules/bootstrap/dist/css/bootstrap.min.css'] + providers: [notification_service_1.NotificationService] }), - __metadata("design:paramtypes", [http_1.HttpClient]) + __metadata("design:paramtypes", [http_1.HttpClient, notification_service_1.NotificationService]) ], ReportsAdministrationComponent); return ReportsAdministrationComponent; }()); diff --git a/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.ts index eddbf696f1cff348f0794e5a943976f22c02a9f0..e578dfe92f1b83e45e1339d92d5c1b5f2b62925a 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.ts @@ -1,29 +1,30 @@ import { Component, OnInit } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { LANG } from '../translate.component'; +import { NotificationService } from '../notification.service'; declare function $j (selector: any) : any; -declare function successNotification(message: string) : void; -declare function errorNotification(message: string) : void; -declare const angularGlobals : any; +declare var angularGlobals : any; @Component({ templateUrl : angularGlobals["reports-administrationView"], - styleUrls : ['../../node_modules/bootstrap/dist/css/bootstrap.min.css'] + providers : [NotificationService] }) export class ReportsAdministrationComponent implements OnInit { coreUrl : string; lang : any = LANG; + groups : any[] = []; reports : any[] = []; - selectedGroup : string = ""; + loading : boolean = false; + - constructor(public http: HttpClient) { + constructor(public http: HttpClient, private notify: NotificationService) { } updateBreadcrumb(applicationName: string) { @@ -36,27 +37,33 @@ export class ReportsAdministrationComponent implements OnInit { this.updateBreadcrumb(angularGlobals.applicationName); this.coreUrl = angularGlobals.coreUrl; - this.http.get(this.coreUrl + 'rest/groups') + this.loading = true; + + this.http.get(this.coreUrl + 'rest/reports/groups') .subscribe((data: any) => { this.groups = data['groups']; + + this.loading = false; + }, () => { + location.href = "index.php"; }); } loadReports() { - this.http.get(this.coreUrl + 'rest/reports/groups/'+ this.selectedGroup) + this.http.get(this.coreUrl + 'rest/reports/groups/' + this.selectedGroup) .subscribe((data: any) => { this.reports = data['reports']; }, (err) => { - errorNotification(err.error.errors); + this.notify.error(err.error.errors); }); } onSubmit() { - this.http.put(this.coreUrl + 'rest/reports/groups/'+ this.selectedGroup, this.reports) - .subscribe((data: any) => { - successNotification(data['success']); + this.http.put(this.coreUrl + 'rest/reports/groups/' + this.selectedGroup, this.reports) + .subscribe(() => { + this.notify.success(this.lang.modificationSaved); }, (err) => { - errorNotification(err.error.errors); + this.notify.error(err.error.errors); }); } } \ No newline at end of file diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.js b/apps/maarch_entreprise/js/angular/lang/lang-en.js index 69bbc9f2e788e6c7b7c0b0e3ccf1562541011e11..306388e0d9d8d2d8aa48eadc3d6d13caa1546f43 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-en.js +++ b/apps/maarch_entreprise/js/angular/lang/lang-en.js @@ -9,6 +9,7 @@ exports.LANG_EN = { "actionHistory": "Log action in history", "actionHistoryDesc": "Lets you plot this action in the document history. It is strongly recommended to check this option", "actionModification": "Action modification", + "actionName": "Action name", "actionPage": "Result page of the action", "actions": "Action(s)", "actionUpdated": "Action updated", @@ -122,6 +123,7 @@ exports.LANG_EN = { "statusDeleted": "Status deleted", "statuses": "Statuses", "statusModification": "Status modification", + "statusName": "Status name", "statusUpdated": "Status updated", "suspend": "Suspend", "system": "System", diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.ts b/apps/maarch_entreprise/js/angular/lang/lang-en.ts index 03f431d259cad377f4d600e3e67b8d88199ff9ce..90540516e7d37784d18441d2fd9e5e99e9742ec6 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-en.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-en.ts @@ -7,6 +7,7 @@ export const LANG_EN = { "actionHistory" : "Log action in history", "actionHistoryDesc" : "Lets you plot this action in the document history. It is strongly recommended to check this option", "actionModification" : "Action modification", + "actionName" : "Action name", "actionPage" : "Result page of the action", "actions" : "Action(s)", "actionUpdated" : "Action updated", @@ -17,7 +18,7 @@ export const LANG_EN = { "administration" : "Administration", "application" : "Application", "associatedStatus" : "Associated status", - "attachments" : "Pièce(s) jointe(s)", + "attachments" : "Attachments", "authorize" : "Authorize", "autoLogoutAbsence" : "You are going to be automaticaly disconnected after your redirections", "avis" : "Avis circuit", @@ -120,6 +121,7 @@ export const LANG_EN = { "statusDeleted" : "Status deleted", "statuses" : "Statuses", "statusModification" : "Status modification", + "statusName" : "Status name", "statusUpdated" : "Status updated", "suspend" : "Suspend", "system" : "System", diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.js b/apps/maarch_entreprise/js/angular/lang/lang-fr.js index 954b0390687b24cf6edafe83a6844a8c4e323f3e..a60d3b093d9e81432a894f62a70aab722fef33bf 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-fr.js +++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.js @@ -11,6 +11,7 @@ exports.LANG_FR = { "actionHistory": "Tracer l'action", "actionHistoryDesc": "Permet tracer cette action dans l'historique du document. Il est fortement recommandé de cocher cette option.", "actionModification": "Modification de l'action", + "actionName": "Nom de l'action", "actionPage": "Page de résultat de l'action", "actions": "Action(s)", "actionUpdated": "Action modifiée", @@ -155,6 +156,7 @@ exports.LANG_FR = { "statusDeleted": "Statut supprimé", "statuses": "Statut(s)", "statusModification": "Modification du statut", + "statusName": "Nom du statut", "statusUpdated": "Statut mis à jour", "string": "Chaine de caratère", "suspend": "Suspendre", diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts index f5bce0a0e3c90726d65df9d9e6cd29780e418f12..366a493afc4a95d3ac85930a782927d46bfa76f4 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts @@ -6,15 +6,16 @@ export const LANG_FR = { "actionAdded" : "Action ajoutée", "actionCreation" : "Création d'une action", "actionDeleted" : "Action supprimée", - "actionHistory" : "Tracer l'action", - "actionHistoryDesc" : "Permet tracer cette action dans l'historique du document. Il est fortement recommandé de cocher cette option.", - "actionModification" : "Modification de l'action", - "actionPage" : "Page de résultat de l'action", - "actions" : "Action(s)", - "actionUpdated" : "Action modifiée", - "activateAbs" : "Activer l'absence", - "activateAbsence" : "Activer l'absence", - "active" : "Actif", + "actionHistory" : "Tracer l'action", + "actionHistoryDesc" : "Permet tracer cette action dans l'historique du document. Il est fortement recommandé de cocher cette option.", + "actionModification" : "Modification de l'action", + "actionName" : "Nom de l'action", + "actionPage" : "Page de résultat de l'action", + "actions" : "Action(s)", + "actionUpdated" : "Action modifiée", + "activateAbs" : "Activer l'absence", + "activateAbsence" : "Activer l'absence", + "active" : "Actif", "add" : "Ajouter", "addStatus" : "Ajouter un statut", "administration" : "Administration", @@ -125,10 +126,10 @@ export const LANG_FR = { "phoneNumber" : "Numéro de téléphone", "previous" : "Précecdent", "primaryEntity" : "Entité primaire", - "priorityAdded" : "Priorité ajoutée", - "priorityDeleted" : "Priorité supprimée", - "priorityUpdated" : "Priorité modifiée", - "processDelay" : "Délai de traitement", + "priorityAdded" : "Priorité ajoutée", + "priorityDeleted" : "Priorité supprimée", + "priorityUpdated" : "Priorité modifiée", + "processDelay" : "Délai de traitement", "pswReseted" : "Mot de passe réinitialisé", "record" : "élément(s)", "records" : "résultats", @@ -153,6 +154,7 @@ export const LANG_FR = { "statusDeleted" : "Statut supprimé", "statuses" : "Statut(s)", "statusModification" : "Modification du statut", + "statusName" : "Nom du statut", "statusUpdated" : "Statut mis à jour", "string" : "Chaine de caratère", "suspend" : "Suspendre", diff --git a/apps/maarch_entreprise/xml/IVS/requests_definitions.xml b/apps/maarch_entreprise/xml/IVS/requests_definitions.xml index b04d363c80a1bf27e5b535031e2d7bb59a044a44..e635267e6ed15dcf9270e420a08425e8126a3619 100755 --- a/apps/maarch_entreprise/xml/IVS/requests_definitions.xml +++ b/apps/maarch_entreprise/xml/IVS/requests_definitions.xml @@ -50,18 +50,6 @@ <parameter name="display" value="true"/> </requestDefinition> - <!-- Admin action --> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_ajax_search" > - <parameter name="admin" value="action"/> - <parameter name="page" value="action_list_by_name"/> - <parameter name="display" value="true"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_action" > - <parameter name="admin" value="action"/> - <parameter name="page" value="action_management_controler"/> - <parameter name="id" /> - </requestDefinition> - <!-- Admin architecture --> <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="admin_architecture" > <parameter name="admin" value="architecture"/> diff --git a/composer.json b/composer.json index fd14246830befe860d79b4dd4906625a40a17cce..9ba084e910e2fdfcc62deb8b85fe81af42afaf44 100755 --- a/composer.json +++ b/composer.json @@ -8,6 +8,7 @@ "History\\" : "src/app/history/", "Parameter\\" : "src/app/parameter/", "Priority\\" : "src/app/priority/", + "Report\\" : "src/app/report/", "Resource\\" : "src/app/resource/", "Status\\" : "src/app/status/", diff --git a/rest/index.php b/rest/index.php index d849286c732797d2b688280aa471ffbcf63ad1e9..5983a3607b9c4447654bb564615d9de32c5bc83d 100755 --- a/rest/index.php +++ b/rest/index.php @@ -118,8 +118,8 @@ $app->get('/administration/notifications/{id}', \Notifications\Controllers\Notif //Baskets $app->get('/baskets', \Basket\controllers\BasketController::class . ':get'); -$app->get('/baskets/{id}', \Basket\controllers\BasketController::class . ':getById'); $app->post('/baskets', \Basket\controllers\BasketController::class . ':create'); +$app->get('/baskets/{id}', \Basket\controllers\BasketController::class . ':getById'); $app->put('/baskets/{id}', \Basket\controllers\BasketController::class . ':update'); $app->delete('/baskets/{id}', \Basket\controllers\BasketController::class . ':delete'); $app->get('/baskets/{id}/groups', \Basket\controllers\BasketController::class . ':getGroups'); @@ -132,11 +132,11 @@ $app->put('/sortedBaskets/{id}', \Basket\controllers\BasketController::class . ' //statuses $app->get('/statuses', \Status\controllers\StatusController::class . ':get'); -$app->get('/administration/statuses/new', \Status\controllers\StatusController::class . ':getNewInformations'); -$app->get('/statuses/{identifier}', \Status\controllers\StatusController::class . ':getByIdentifier'); $app->post('/statuses', \Status\controllers\StatusController::class . ':create'); +$app->get('/statuses/{identifier}', \Status\controllers\StatusController::class . ':getByIdentifier'); $app->put('/statuses/{identifier}', \Status\controllers\StatusController::class . ':update'); $app->delete('/statuses/{identifier}', \Status\controllers\StatusController::class . ':delete'); +$app->get('/administration/statuses/new', \Status\controllers\StatusController::class . ':getNewInformations'); //groups $app->get('/groups', \Core\Controllers\GroupController::class . ':get'); @@ -220,11 +220,11 @@ $app->put('/priorities/{id}', \Priority\controllers\PriorityController::class . $app->delete('/priorities/{id}', \Priority\controllers\PriorityController::class . ':delete'); //History -$app->get('/administration/history/eventDate/{date}', \History\controllers\HistoryController::class . ':getForAdministration'); +$app->get('/administration/history/eventDate/{date}', \History\controllers\HistoryController::class . ':getForAdministration'); //TODO No date $app->get('/histories/users/{userSerialId}', \History\controllers\HistoryController::class . ':getByUserId'); //HistoryBatch -$app->get('/administration/historyBatch/eventDate/{date}', \History\controllers\HistoryController::class . ':getBatchForAdministration'); +$app->get('/administration/historyBatch/eventDate/{date}', \History\controllers\HistoryController::class . ':getBatchForAdministration');//TODO No date //actions $app->get('/actions', \Action\controllers\ActionController::class . ':get'); @@ -242,8 +242,9 @@ $app->put('/notifications/{id}', \Notifications\Controllers\NotificationControll $app->delete('/notifications/{id}', \Notifications\Controllers\NotificationController::class . ':delete'); //Reports -$app->get('/reports/groups/{groupId}', \Core\Controllers\ReportController::class . ':getByGroupId'); -$app->put('/reports/groups/{groupId}', \Core\Controllers\ReportController::class . ':updateForGroupId'); +$app->get('/reports/groups', \Report\controllers\ReportController::class . ':getGroups'); +$app->get('/reports/groups/{groupId}', \Report\controllers\ReportController::class . ':getByGroupId'); +$app->put('/reports/groups/{groupId}', \Report\controllers\ReportController::class . ':updateForGroupId'); //Listinstance $app->get('/listinstance/{id}', \Core\Controllers\ListinstanceController::class . ':getById'); @@ -258,6 +259,6 @@ $app->post('/templates/{id}/duplicate', \Templates\Controllers\TemplateControlle $app->get('/links/resId/{resId}', \Core\Controllers\LinkController::class . ':getByResId'); //liste documents -$app->get('/res/listDocs/{clause}/{select}', \Core\Controllers\ResController::class . ':getListDocs'); +$app->get('/res/listDocs/{clause}/{select}', \Resource\controllers\ResController::class . ':getListDocs');//TODO No clause $app->run(); diff --git a/src/app/action/controllers/ActionController.php b/src/app/action/controllers/ActionController.php index 1568caa954a3acfb6a0d3a910c7c0eb5c1c30909..2afa6630cb64edc5be5b7f92f30c85b9b65919fc 100644 --- a/src/app/action/controllers/ActionController.php +++ b/src/app/action/controllers/ActionController.php @@ -11,10 +11,11 @@ namespace Action\controllers; +use History\controllers\HistoryController; use Respect\Validation\Validator; use Action\models\ActionModel; use Status\models\StatusModel; -use Core\Models\LangModel; +use Core\Models\ServiceModel; use Slim\Http\Request; use Slim\Http\Response; @@ -22,6 +23,10 @@ class ActionController { public function get(Request $request, Response $response) { + if (!ServiceModel::hasService(['id' => 'admin_actions', 'userId' => $GLOBALS['userId'], 'location' => 'apps', 'type' => 'admin'])) { + return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); + } + $obj ['actions']= ActionModel::get(); return $response->withJson($obj); @@ -35,7 +40,7 @@ class ActionController } else { return $response ->withStatus(500) - ->withJson(['errors' => _ID . ' ' . _IS_EMPTY]); + ->withJson(['errors' => 'id is empty']); } if ($obj['action']['is_folder_action'] == 'Y') { @@ -91,6 +96,10 @@ class ActionController public function create(Request $request, Response $response, $aArgs) { + if (!ServiceModel::hasService(['id' => 'admin_actions', 'userId' => $GLOBALS['userId'], 'location' => 'apps', 'type' => 'admin'])) { + return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); + } + $errors = []; $aArgs = $request->getParams(); $aArgs = $this->manageValue($aArgs); @@ -106,8 +115,6 @@ class ActionController $return = ActionModel::create($aArgs); if ($return) { - $id = $aArgs['id']; - $obj = max(ActionModel::get()); } else { return $response @@ -115,16 +122,27 @@ class ActionController ->withJson(['errors' => _NOT_CREATE]); } + HistoryController::add([ + 'tableName' => 'actions', + 'recordId' => $obj['id'], + 'eventType' => 'ADD', + 'eventId' => 'actionadd', + 'info' => _ACTION. ' "' . $obj['label_action'] .'" ' ._ADDED + ]); + return $response->withJson( [ - 'success' => _ACTION. ' <b>' . $obj['id'] .'</b> ' ._ADDED, - 'action' => $obj + 'action' => $obj ] ); } public function update(Request $request, Response $response, $aArgs) { + if (!ServiceModel::hasService(['id' => 'admin_actions', 'userId' => $GLOBALS['userId'], 'location' => 'apps', 'type' => 'admin'])) { + return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); + } + $errors = []; $obj = $request->getParams(); @@ -142,7 +160,7 @@ class ActionController $return = ActionModel::update($obj); if ($return) { - $id = $aArgs['id']; + $id = $aArgs['id']; $obj = ActionModel::getById(['id' => $id]); } else { return $response @@ -150,29 +168,48 @@ class ActionController ->withJson(['errors' => _NOT_UPDATE]); } + HistoryController::add([ + 'tableName' => 'actions', + 'recordId' => $obj['id'], + 'eventType' => 'UP', + 'eventId' => 'actionup', + 'info' => _ACTION. ' "' . $obj['label_action'] .'" ' ._UPDATED + ]); + return $response->withJson( [ - 'success' => _ACTION. ' <b>' . $id .'</b> ' ._UPDATED, - 'action' => $obj + 'action' => $obj ] ); } public function delete(Request $request, Response $response, $aArgs) { + if (!ServiceModel::hasService(['id' => 'admin_actions', 'userId' => $GLOBALS['userId'], 'location' => 'apps', 'type' => 'admin'])) { + return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); + } + if (isset($aArgs['id'])) { - $id = $aArgs['id']; + $id = $aArgs['id']; + $obj = ActionModel::getById(['id' => $id]); ActionModel::delete(['id' => $id]); } else { return $response ->withStatus(500) ->withJson(['errors' => _NOT_DELETE]); } - + + HistoryController::add([ + 'tableName' => 'actions', + 'recordId' => $id, + 'eventType' => 'DEL', + 'eventId' => 'actiondel', + 'info' => _ACTION. ' "' . $obj['label_action'] .'" ' ._DELETED + ]); + return $response->withJson( [ - 'success' => _ACTION. ' <b>' . $id .'</b> ' ._DELETED, - 'action' => ActionModel::get() + 'action' => ActionModel::get() ] ); } @@ -184,44 +221,44 @@ class ActionController $objs = StatusModel::get(); foreach ($objs as $obj) { - $status[]=$obj['id']; + $status[] = $obj['id']; } array_unshift($status, '_NOSTATUS_'); if (!(in_array($aArgs['id_status'], $status))) { - $errors[]=_STATUS. ' ' . _NOT_VALID; + $errors[]= 'Invalid Status'; } if ($mode == 'update') { $obj = ActionModel::getById(['id' => $aArgs['id']]); if (empty($obj)) { - $errors[]=_ID . ' ' .$aArgs['id']. ' ' . _NOT_EXISTS; + $errors[] = _ID . ' ' .$aArgs['id']. ' ' . _NOT_EXISTS; } } - if (!Validator::notEmpty()->validate($aArgs['label_action'])) { - $errors[]=_NO_RIGHT.' '._DESC; + if (!Validator::notEmpty()->validate($aArgs['label_action']) || + !Validator::length(1, 255)->validate($aArgs['label_action'])) { + $errors[] = 'Invalid label action'; } if (!Validator::notEmpty()->validate($aArgs['id_status'])) { - $errors[]=CHOOSE_STATUS; + $errors[] = 'id_status is empty'; } - if (!Validator::notEmpty()->validate($aArgs['create_id']) || ($aArgs['create_id']!='Y' && $aArgs['create_id']!='N')) { - $errors[]= _CREATE_ID . ' ' . _NOT_VALID; + if (!Validator::notEmpty()->validate($aArgs['create_id']) || ($aArgs['create_id'] != 'Y' && $aArgs['create_id'] != 'N')) { + $errors[]= 'Invalid create_id value'; } - if (!Validator::notEmpty()->validate($aArgs['history']) || ($aArgs['history']!='Y' && $aArgs['history']!='N')) { - $errors[]= _ACTION_HISTORY . ' ' . _NOT_VALID; + if (!Validator::notEmpty()->validate($aArgs['history']) || ($aArgs['history'] != 'Y' && $aArgs['history'] != 'N')) { + $errors[]= 'Invalid history value'; } - if (!Validator::notEmpty()->validate($aArgs['is_system']) || ($aArgs['is_system']!='Y' && $aArgs['is_system']!='N')) { - $errors[]= _IS_SYSTEM . ' ' . _NOT_VALID; + if (!Validator::notEmpty()->validate($aArgs['is_system']) || ($aArgs['is_system'] != 'Y' && $aArgs['is_system'] != 'N')) { + $errors[]= 'Invalid is_system value'; } - return $errors; } diff --git a/src/app/action/models/ActionModelAbstract.php b/src/app/action/models/ActionModelAbstract.php index 8323e138a29bf8043aa8df7d9ee783870b28e6aa..ee8e0ed8b0036de3858ba763646415be4bc3dff3 100644 --- a/src/app/action/models/ActionModelAbstract.php +++ b/src/app/action/models/ActionModelAbstract.php @@ -22,8 +22,8 @@ class ActionModelAbstract ValidatorModel::arrayType($aArgs, ['select']); $actions = DatabaseModel::select([ - 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], - 'table' => ['actions'] + 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], + 'table' => ['actions'] ]); return $actions; @@ -36,10 +36,10 @@ class ActionModelAbstract $aReturn = DatabaseModel::select( [ - 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], - 'table' => ['actions'], - 'where' => ['id = ?'], - 'data' => [$aArgs['id']] + 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], + 'table' => ['actions'], + 'where' => ['id = ?'], + 'data' => [$aArgs['id']] ] ); @@ -48,12 +48,12 @@ class ActionModelAbstract } $aReturn = $aReturn[0]; - $aReturn['actionCategories']=DatabaseModel::select( + $aReturn['actionCategories'] = DatabaseModel::select( [ - 'select' => ['category_id'], - 'table' => ['actions_categories'], - 'where' => ['action_id = ?'], - 'data' => [$aArgs['id']] + 'select' => ['category_id'], + 'table' => ['actions_categories'], + 'where' => ['action_id = ?'], + 'data' => [$aArgs['id']] ] ); @@ -106,12 +106,12 @@ class ActionModelAbstract $aDelete = DatabaseModel::delete( ['table' => 'actions_categories', - 'where' => ['action_id = ?'], - 'data' => [$aArgs['id']] + 'where' => ['action_id = ?'], + 'data' => [$aArgs['id']] ] ); - $tab['action_id']=$aArgs['id']; + $tab['action_id'] = $aArgs['id']; for ($i=0;$i<count($aArgs['actionCategories']);$i++) { $tab['category_id']=$aArgs['actionCategories'][$i]; @@ -138,13 +138,22 @@ class ActionModelAbstract 'data' => [$aArgs['id']] ] ); - $aDelete = DatabaseModel::delete( + DatabaseModel::delete( [ 'table' => 'actions_categories', 'where' => ['action_id = ?'], 'data' => [$aArgs['id']] ] ); + + DatabaseModel::delete( + [ + 'table' => 'actions_groupbaskets', + 'where' => ['id_action = ?'], + 'data' => [$aArgs['id']] + ] + ); + return $aReturn; } @@ -158,9 +167,9 @@ class ActionModelAbstract $path = 'apps/maarch_entreprise/xml/config.xml'; } - $xmlfile = simplexml_load_file($path); - $categoriesTypes=[]; - $categories= $xmlfile->COLLECTION->categories; + $xmlfile = simplexml_load_file($path); + $categoriesTypes = []; + $categories = $xmlfile->COLLECTION->categories; if (count($categories) > 0) { foreach ($categories->category as $category) { $categoriesTmp = ['id' => (string)$category->id, 'label'=> constant((string)$category->label)]; @@ -170,7 +179,7 @@ class ActionModelAbstract } else { $categoriesTmp['default_category']=false; } - $categoriesTypes[]=$categoriesTmp; + $categoriesTypes[] = $categoriesTmp; } } return $categoriesTypes; @@ -186,7 +195,7 @@ class ActionModelAbstract $path = 'core/xml/actions_pages.xml'; } - $tabActions_pages=[]; + $tabActions_pages = []; $tabActions_pages['modules'][] = 'Apps'; $xmlfile = simplexml_load_file($path); @@ -209,57 +218,15 @@ class ActionModelAbstract $desc = 'no description'; } $tabActions_pages['actionsPageList'][] = array( - 'id' => (string) $actionPage->ID, - 'label' => $label, - 'name' => (string) $actionPage->NAME, - 'desc' => $desc, - 'origin' => ucfirst($origin), + 'id' => (string) $actionPage->ID, + 'label' => $label, + 'name' => (string) $actionPage->NAME, + 'desc' => $desc, + 'origin' => ucfirst($origin), ); } } - // TODO Remove session -// foreach ($_SESSION['modules'] as $key => $value) { -// -// if (file_exists('custom/'. $_SESSION['custom_override_id'] . 'modules/' . $value['moduleid'] . '/xml/actions_pages.xml')) { -// $path = $_SESSION['config']['corepath'] . 'custom/' . $_SESSION['custom_override_id'] . '/modules/' . $value['moduleid'] . '/xml/actions_pages.xml'; -// } else if (file_exists('modules/' . $value['moduleid'] . '/xml/actions_pages.xml')) { -// $path = 'modules/' . $value['moduleid'] . '/xml/actions_pages.xml'; -// } else { -// $path = ''; -// } -// -// if (!empty($path)) { -// $xmlfile = simplexml_load_file($path); -// if (count($xmlfile) > 0) { -// foreach ($xmlfile->ACTIONPAGE as $actionPage) { -// if (!defined((string) $actionPage->LABEL)) { -// $label = $actionPage->LABEL; -// } else { -// $label = constant((string) $actionPage->LABEL); -// } -// if (!empty((string) $actionPage->MODULE)) { -// $origin = (string) $actionPage->MODULE; -// } else { -// $origin = 'apps'; -// } -// if (!empty((string) $actionPage->DESC)) { -// $desc = constant((string) $actionPage->DESC); -// } else { -// $desc = 'no description'; -// } -// $tabActions_pages['modules'][] = ucfirst($origin); -// -// $tabActions_pages['actionsPageList'][] = array( -// 'id' => (string) $actionPage->ID, -// 'label' => $label, -// 'name' => (string) $actionPage->NAME, -// 'desc' => $desc, -// 'origin' => ucfirst($origin), -// ); -// } -// } -// } -// } + array_multisort( array_map( function ($element) { @@ -276,7 +243,7 @@ class ActionModelAbstract public static function getKeywords() { - $tabKeyword=[]; + $tabKeyword = []; $tabKeyword[] = ['value' => '', label => _NO_KEYWORD]; $tabKeyword[] = ['value' => 'redirect', label => _REDIRECT, desc => _KEYWORD_REDIRECT_DESC]; //$tabKeyword[] = ['value' => 'to_validate', label => _TO_VALIDATE]; @@ -292,10 +259,10 @@ class ActionModelAbstract ValidatorModel::intVal($aArgs, ['id']); $action = DatabaseModel::select([ - 'select' => ['action_page'], - 'table' => ['actions'], - 'where' => ['id = ? AND enabled = ?'], - 'data' => [$aArgs['id'], 'Y'] + 'select' => ['action_page'], + 'table' => ['actions'], + 'where' => ['id = ? AND enabled = ?'], + 'data' => [$aArgs['id'], 'Y'] ]); if (empty($action[0])) { @@ -311,10 +278,10 @@ class ActionModelAbstract ValidatorModel::stringType($aArgs, ['groupId', 'basketId']); $action = DatabaseModel::select([ - 'select' => ['id_action'], - 'table' => ['actions_groupbaskets'], - 'where' => ['group_id = ?', 'basket_id = ?', 'default_action_list = ?'], - 'data' => [$aArgs['groupId'], $aArgs['basketId'], 'Y'] + 'select' => ['id_action'], + 'table' => ['actions_groupbaskets'], + 'where' => ['group_id = ?', 'basket_id = ?', 'default_action_list = ?'], + 'data' => [$aArgs['groupId'], $aArgs['basketId'], 'Y'] ]); if (empty($action[0])) { diff --git a/core/Controllers/ReportController.php b/src/app/report/controllers/ReportController.php old mode 100755 new mode 100644 similarity index 70% rename from core/Controllers/ReportController.php rename to src/app/report/controllers/ReportController.php index e8b9d93a4c0b351ecfb1d449c8bc13568e05de2d..62bb064a9758c6d3c6346e40dc6b3526d6dd7664 --- a/core/Controllers/ReportController.php +++ b/src/app/report/controllers/ReportController.php @@ -10,23 +10,31 @@ /** * @brief Report Controller * @author dev@maarch.org -* @ingroup core */ -namespace Core\Controllers; +namespace Report\controllers; use Core\Models\GroupModel; use Core\Models\ServiceModel; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; -use Core\Models\ReportModel; +use Report\models\ReportModel; +use Slim\Http\Request; +use Slim\Http\Response; class ReportController { - public function getByGroupId(RequestInterface $request, ResponseInterface $response, $aArgs) + public function getGroups(Request $request, Response $response) { - if (!ServiceModel::hasService(['id' => 'admin_reports', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) { + if (!ServiceModel::hasService(['id' => 'admin_reports', 'userId' => $GLOBALS['userId'], 'location' => 'reports', 'type' => 'admin'])) { + return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); + } + + return $response->withJson(['groups' => GroupModel::get()]); + } + + public function getByGroupId(Request $request, Response $response, array $aArgs) + { + if (!ServiceModel::hasService(['id' => 'admin_reports', 'userId' => $GLOBALS['userId'], 'location' => 'reports', 'type' => 'admin'])) { return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); } @@ -40,9 +48,9 @@ class ReportController return $response->withJson(['reports' => $reports]); } - public function updateForGroupId(RequestInterface $request, ResponseInterface $response, $aArgs) + public function updateForGroupId(Request $request, Response $response, array $aArgs) { - if (!ServiceModel::hasService(['id' => 'admin_reports', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) { + if (!ServiceModel::hasService(['id' => 'admin_reports', 'userId' => $GLOBALS['userId'], 'location' => 'reports', 'type' => 'admin'])) { return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); } @@ -75,7 +83,7 @@ class ReportController ReportModel::deleteForGroupId(['groupId' => $aArgs['groupId'], 'reportIds' => $reportIdsToDelete]); } - return $response->withJson(['success' => _SAVED_CHANGE]); + return $response->withJson(['success' => 'success']); } } diff --git a/core/Models/ReportModel.php b/src/app/report/models/ReportModel.php old mode 100755 new mode 100644 similarity index 71% rename from core/Models/ReportModel.php rename to src/app/report/models/ReportModel.php index 149a59edb615ee7ea3c495b4b820d9142281ca83..bfb7bed03986f36412f0f6404ab5c6d74f068553 --- a/core/Models/ReportModel.php +++ b/src/app/report/models/ReportModel.php @@ -8,14 +8,12 @@ */ /** -* @brief Attachment Model +* @brief Report Model * @author dev@maarch.org -* @ingroup core */ -namespace Core\Models; +namespace Report\models; class ReportModel extends ReportModelAbstract { - // Do your stuff in this class } diff --git a/core/Models/ReportModelAbstract.php b/src/app/report/models/ReportModelAbstract.php old mode 100755 new mode 100644 similarity index 76% rename from core/Models/ReportModelAbstract.php rename to src/app/report/models/ReportModelAbstract.php index 375ade90752945e8e6da00652b3f17d9e6370618..065cc9db969453604b28bbd626ae59739e806bb5 --- a/core/Models/ReportModelAbstract.php +++ b/src/app/report/models/ReportModelAbstract.php @@ -8,12 +8,15 @@ */ /** -* @brief Reports Model +* @brief Report Model Abstract * @author dev@maarch.org -* @ingroup core */ -namespace Core\Models; +namespace Report\models; + +use Core\Models\CoreConfigModel; +use Core\Models\DatabaseModel; +use Core\Models\ValidatorModel; class ReportModelAbstract { @@ -30,21 +33,21 @@ class ReportModelAbstract } $reports = []; - $xmlfile = simplexml_load_file($path); + $xmlfile = simplexml_load_file($path); if ($xmlfile) { foreach ($xmlfile->REPORT as $value) { if ((string)$value->ENABLED == "true") { $reports[] = [ - 'id' => (string)$value->ID, - 'label' => constant((string)$value->LABEL), - 'desc' => constant((string)$value->DESCRIPTION), - 'url' => (string)$value->URL, - 'in_menu_reports' =>(string)$value->IN_MENU_REPORTS, - 'origin' => (string)$value->ORIGIN, - 'module' => (string)$value->MODULE, - 'module_label' => (string)$value->MODULE_LABEL, - 'checked' => false + 'id' => (string)$value->ID, + 'label' => constant((string)$value->LABEL), + 'desc' => constant((string)$value->DESCRIPTION), + 'url' => (string)$value->URL, + 'in_menu_reports' => (string)$value->IN_MENU_REPORTS, + 'origin' => (string)$value->ORIGIN, + 'module' => (string)$value->MODULE, + 'module_label' => (string)$value->MODULE_LABEL, + 'checked' => false ]; } } diff --git a/src/app/status/controllers/StatusController.php b/src/app/status/controllers/StatusController.php index dbd8f09b054d1c92dd1ebd5d8c01bdf4a11a7f61..80a8b7ac3d356d5b31a80dd8abc9f974c4d365e8 100755 --- a/src/app/status/controllers/StatusController.php +++ b/src/app/status/controllers/StatusController.php @@ -202,52 +202,52 @@ class StatusController if (!Validator::regex('/^[\w.-]*$/')->validate($request['id']) || !Validator::length(1, 10)->validate($request['id']) || !Validator::notEmpty()->validate($request['id'])) { - array_push($errors, _ID . ' ' . _INVALID); + array_push($errors, 'Invalid id value'); } if (!Validator::notEmpty()->validate($request['label_status']) || !Validator::length(1, 50)->validate($request['label_status'])) { - array_push($errors, _DESCRIPTION . ' ' . _INVALID); + array_push($errors, 'Invalid label_status value'); } if (Validator::notEmpty()->validate($request['is_system']) && !Validator::contains('Y')->validate($request['is_system']) && !Validator::contains('N')->validate($request['is_system']) ) { - array_push($errors, 'is_system ' . _INVALID); + array_push($errors, 'Invalid is_system value'); } if (Validator::notEmpty()->validate($request['is_folder_status']) && !Validator::contains('Y')->validate($request['is_folder_status']) && !Validator::contains('N')->validate($request['is_folder_status']) ) { - array_push($errors, _IS_FOLDER_STATUS . ' ' . _INVALID); + array_push($errors, 'Invalid is_folder_status value'); } if (!Validator::notEmpty()->validate($request['img_filename']) || !Validator::length(1, 255)->validate($request['img_filename']) ) { - array_push($errors, _IMG_RELATED . ' ' . _INVALID); + array_push($errors, 'Invalid img_filename value'); } if (Validator::notEmpty()->validate($request['maarch_module']) && !Validator::length(null, 255)->validate($request['maarch_module']) ) { - array_push($errors, 'maarch_module ' . _INVALID); + array_push($errors, 'Invalid maarch_module value'); } if (Validator::notEmpty()->validate($request['can_be_searched']) && !Validator::contains('Y')->validate($request['can_be_searched']) && !Validator::contains('N')->validate($request['can_be_searched']) ) { - array_push($errors, _CAN_BE_SEARCHED . ' ' . _INVALID); + array_push($errors, 'Invalid can_be_searched value'); } if (Validator::notEmpty()->validate($request['can_be_modified']) && !Validator::contains('Y')->validate($request['can_be_modified']) && !Validator::contains('N')->validate($request['can_be_modified']) ) { - array_push($errors, _CAN_BE_MODIFIED . ' ' . _INVALID); + array_push($errors, 'Invalid can_be_modified value'); } return $errors;