Commit 2109efa0 authored by Florian Azizian's avatar Florian Azizian

FIX #10633 TIME 0:25 rm old action_pages

parent aef90152
......@@ -50,52 +50,52 @@ job_php-7.3:
only:
- develop
# job_php-7.2:
# image: php:7.2-apache
# stage: test
# script:
# - mkdir -p /opt/maarch/docservers/indexes/{letterbox_coll,attachments_coll,version_attachments_coll}
# - mkdir -p /opt/maarch/docservers/{ai,manual,manual_attachments,templates}
# - mkdir -p /opt/maarch/docservers/{convert_attachments,convert_attachments_version,convert_mlb}
# - mkdir -p /opt/maarch/docservers/{fulltext_attachments,fulltext_attachments_version,fulltext_mlb}
# - mkdir -p /opt/maarch/docservers/{thumbnails_attachments,thumbnails_attachments_version,thumbnails_mlb}
# - mkdir -p /var/www/html/
# - cp -R /builds/maarch/MaarchCourrier/ /var/www/html/
# - cd /var/www/html/MaarchCourrier
# - mkdir -p /var/www/html/MaarchCourrier
# #- curl -sL https://deb.nodesource.com/setup_7.x | bash -
# #- apt-get install -yqq nodejs
# #- npm install npm@latest -g
# #- npm set registry https://registry.npmjs.org/
# #- npm install
# - sed 's/<databaseserver>.*<\/databaseserver>/<databaseserver>postgres<\/databaseserver>/;s/<databasepassword>.*<\/databasepassword>/<databasepassword><\/databasepassword>/;s/<databasename>.*<\/databasename>/<databasename>MaarchCourrier<\/databasename>/;s/<databaseuser>.*<\/databaseuser>/<databaseuser>maarch<\/databaseuser>/' apps/maarch_entreprise/xml/config.xml.default > apps/maarch_entreprise/xml/config.xml
# - curl --location -s --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-7.phar
# - chmod +x /usr/local/bin/phpunit
# - phpunit --coverage-text --colors=never -c phpunit.xml
# only:
# - develop
job_php-7.2:
image: php:7.2-apache
stage: test
script:
- mkdir -p /opt/maarch/docservers/indexes/{letterbox_coll,attachments_coll,version_attachments_coll}
- mkdir -p /opt/maarch/docservers/{ai,manual,manual_attachments,templates}
- mkdir -p /opt/maarch/docservers/{convert_attachments,convert_attachments_version,convert_mlb}
- mkdir -p /opt/maarch/docservers/{fulltext_attachments,fulltext_attachments_version,fulltext_mlb}
- mkdir -p /opt/maarch/docservers/{thumbnails_attachments,thumbnails_attachments_version,thumbnails_mlb}
- mkdir -p /var/www/html/
- cp -R /builds/maarch/MaarchCourrier/ /var/www/html/
- cd /var/www/html/MaarchCourrier
- mkdir -p /var/www/html/MaarchCourrier
#- curl -sL https://deb.nodesource.com/setup_7.x | bash -
#- apt-get install -yqq nodejs
#- npm install npm@latest -g
#- npm set registry https://registry.npmjs.org/
#- npm install
- sed 's/<databaseserver>.*<\/databaseserver>/<databaseserver>postgres<\/databaseserver>/;s/<databasepassword>.*<\/databasepassword>/<databasepassword><\/databasepassword>/;s/<databasename>.*<\/databasename>/<databasename>MaarchCourrier<\/databasename>/;s/<databaseuser>.*<\/databaseuser>/<databaseuser>maarch<\/databaseuser>/' apps/maarch_entreprise/xml/config.xml.default > apps/maarch_entreprise/xml/config.xml
- curl --location -s --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-7.phar
- chmod +x /usr/local/bin/phpunit
- phpunit --no-coverage
only:
- develop
# job_php-7.1:
# image: php:7.1-apache
# stage: test
# script:
# - mkdir -p /opt/maarch/docservers/indexes/{letterbox_coll,attachments_coll,version_attachments_coll}
# - mkdir -p /opt/maarch/docservers/{ai,manual,manual_attachments,templates}
# - mkdir -p /opt/maarch/docservers/{convert_attachments,convert_attachments_version,convert_mlb}
# - mkdir -p /opt/maarch/docservers/{fulltext_attachments,fulltext_attachments_version,fulltext_mlb}
# - mkdir -p /opt/maarch/docservers/{thumbnails_attachments,thumbnails_attachments_version,thumbnails_mlb}
# - mkdir -p /var/www/html/
# - cp -R /builds/maarch/MaarchCourrier/ /var/www/html/
# - cd /var/www/html/MaarchCourrier
# - mkdir -p /var/www/html/MaarchCourrier
# #- curl -sL https://deb.nodesource.com/setup_7.x | bash -
# #- apt-get install -yqq nodejs
# #- npm install npm@latest -g
# #- npm set registry https://registry.npmjs.org/
# #- npm install
# - sed 's/<databaseserver>.*<\/databaseserver>/<databaseserver>postgres<\/databaseserver>/;s/<databasepassword>.*<\/databasepassword>/<databasepassword><\/databasepassword>/;s/<databasename>.*<\/databasename>/<databasename>MaarchCourrier<\/databasename>/;s/<databaseuser>.*<\/databaseuser>/<databaseuser>maarch<\/databaseuser>/' apps/maarch_entreprise/xml/config.xml.default > apps/maarch_entreprise/xml/config.xml
# - curl --location -s --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-7.phar
# - chmod +x /usr/local/bin/phpunit
# - phpunit --coverage-text --colors=never -c phpunit.xml
# only:
# - develop
job_php-7.1:
image: php:7.1-apache
stage: test
script:
- mkdir -p /opt/maarch/docservers/indexes/{letterbox_coll,attachments_coll,version_attachments_coll}
- mkdir -p /opt/maarch/docservers/{ai,manual,manual_attachments,templates}
- mkdir -p /opt/maarch/docservers/{convert_attachments,convert_attachments_version,convert_mlb}
- mkdir -p /opt/maarch/docservers/{fulltext_attachments,fulltext_attachments_version,fulltext_mlb}
- mkdir -p /opt/maarch/docservers/{thumbnails_attachments,thumbnails_attachments_version,thumbnails_mlb}
- mkdir -p /var/www/html/
- cp -R /builds/maarch/MaarchCourrier/ /var/www/html/
- cd /var/www/html/MaarchCourrier
- mkdir -p /var/www/html/MaarchCourrier
#- curl -sL https://deb.nodesource.com/setup_7.x | bash -
#- apt-get install -yqq nodejs
#- npm install npm@latest -g
#- npm set registry https://registry.npmjs.org/
#- npm install
- sed 's/<databaseserver>.*<\/databaseserver>/<databaseserver>postgres<\/databaseserver>/;s/<databasepassword>.*<\/databasepassword>/<databasepassword><\/databasepassword>/;s/<databasename>.*<\/databasename>/<databasename>MaarchCourrier<\/databasename>/;s/<databaseuser>.*<\/databaseuser>/<databaseuser>maarch<\/databaseuser>/' apps/maarch_entreprise/xml/config.xml.default > apps/maarch_entreprise/xml/config.xml
- curl --location -s --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-7.phar
- chmod +x /usr/local/bin/phpunit
- phpunit --no-coverage
only:
- develop
<?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 Action : simple confirm
*
* Open a modal box to confirm a status modification. Used by the core (manage_action.php page).
*
* @file
* @date $date$
* @version $Revision$
* @ingroup apps
*/
/**
* $confirm bool false
*/
$confirm = false;
$etapes = array('form');
$frm_width = '285px';
$frm_height = 'auto';
function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $coll_id, $mode)
{
$labelAction = '';
if ($id_action <> '') {
$resAction = \Action\models\ActionModel::getById(['id' => $id_action]);
$labelAction = functions::show_string($resAction['label_action']);
}
$values_str = '';
if (empty($_SESSION['stockCheckbox'])) {
for ($i=0; $i < count($values); $i++) {
$values_str .= $values[$i].', ';
}
} else {
for ($i=0; $i < count($_SESSION['stockCheckbox']); $i++) {
$values_str .= $_SESSION['stockCheckbox'][$i].', ';
}
}
$values_str = preg_replace('/, $/', '', $values_str);
$templates = array();
$destination = \Resource\models\ResModel::get(['select' => ['destination'], 'where' => ['res_id in (?)'], 'data' => [explode(", ", $values_str)]]);
if ($destination <> '') {
$aDestination = [];
foreach ($destination as $value) {
$aDestination[] = $value['destination'];
}
$templates = \Template\models\TemplateModel::getByEntity(['select' => ['t.*'], 'entities' => $aDestination]);
} else {
$templates = \Template\models\TemplateModel::get();
}
$frm_str .='<center style="font-size:15px;">'._ACTION_CONFIRM.'<br/><br/><b>'.$labelAction.' ?</b></center><br/>';
if ($_SESSION['current_basket']['id'] != 'IndexingBasket') {
$frm_str .='<b>'._PROCESS_NOTES.':</b><br/>';
$frm_str .= '<select name="templateNotes" id="templateNotes" style="width:98%;margin-bottom: 10px;background-color: White;border: 1px solid #999;color: #666;text-align: left;" '
. 'onchange="addTemplateToNote($(\'templateNotes\').value, \''
. $_SESSION['config']['businessappurl'] . 'index.php?display=true'
. '&module=templates&page=templates_ajax_content_for_notes\');document.getElementById(\'notes\').focus();">';
$frm_str .= '<option value="">' . _SELECT_NOTE_TEMPLATE . '</option>';
foreach ($templates as $value) {
if ($value['template_type'] == 'TXT' && ($value['template_target'] == 'notes' || $value['template_target'] == '')) {
$frm_str .= '<option value="';
$frm_str .= $value['template_id'];
$frm_str .= '">';
$frm_str .= $value['template_label'];
}
$frm_str .= '</option>';
}
$frm_str .= '</select><br />';
$frm_str .= '<textarea placeholder="motif de la clôture (optionnel) ..." style="width:98%;height:60px;resize:none;" name="notes" id="notes" onblur="document.getElementById(\'note_content_to_users\').value=document.getElementById(\'notes\').value;"></textarea>';
}
$frm_str .='<div id="form2" style="border:none;">';
$frm_str .= '<form name="frm_redirect_dep" id="frm_redirect_dep" method="post" class="forms" action="#">';
$frm_str .= '<input type="hidden" name="chosen_action" id="chosen_action" value="end_action" />';
$frm_str .= '<input type="hidden" name="note_content_to_users" id="note_content_to_users" />';
$frm_str .='</form>';
$frm_str .='</div>';
$frm_str .='<div align="center">';
$frm_str .=' <input type="button" name="redirect_dep" value="'._VALIDATE.'" id="redirect_dep" class="button" onclick="valid_action_form( \'frm_redirect_dep\', \''.$path_manage_action.'\', \''. $id_action.'\', \''.$values_str.'\', \''.$table.'\', \''.$module.'\', \''.$coll_id.'\', \''.$mode.'\');" />';
$frm_str .=' <input type="button" name="cancel" id="cancel" class="button" value="'._CANCEL.'" onclick="pile_actions.action_pop();actions_status.action_pop();destroyModal(\'modal_'.$id_action.'\');"/>';
$frm_str .='</div>';
return addslashes($frm_str);
}
function check_form($form_id, $values)
{
return true;
}
function manage_form($arr_id, $history, $id_action, $label_action, $status, $coll_id, $table, $values_form)
{
if (empty($values_form) || count($arr_id) < 1) {
return false;
}
$formValues = array();
for ($i=0; $i<count($values_form); $i++) {
$formValue = $values_form[$i];
$id = $formValue['ID'];
$value = $formValue['VALUE'];
$formValues[$id] = $value;
}
$_SESSION['action_error'] = '';
$result = '';
foreach ($arr_id as $res_id) {
$result .= $res_id.'#';
\Resource\models\ResModel::update(['set' => ['closing_date' => 'CURRENT_TIMESTAMP'], 'where' => ['res_id = ?'], 'data' => [$res_id]]);
# save note
if ($formValues['note_content_to_users'] != '') {
$user = \User\models\UserModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['id']]);
\Note\models\NoteModel::create(['resId' => $res_id, 'user_id' => $user['id'], 'note_text' => $formValues['note_content_to_users']]);
}
}
return ['result' => $result, 'history_msg' => ''];
}
<?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 Action : simple confirm
*
* Open a modal box to confirm a status modification. Used by the core (manage_action.php page).
*
* @file
* @author Claire Figueras <dev@maarch.org>
* @date $date$
* @version $Revision$
* @ingroup apps
*/
/**
* $confirm bool true
*/
$confirm = true;
/**
* $etapes array Contains only one etap, the status modification
*/
$etapes = array('close');
function manage_close($arr_id, $history, $id_action, $label_action, $status)
{
$result = '';
require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_security.php');
require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php');
$sec = new security();
$db = new Database();
$ind_coll = $sec->get_ind_collection($_POST['coll_id']);
for ($i=0; $i<count($arr_id); $i++) {
$result .= $arr_id[$i].'#';
$db->query("UPDATE res_letterbox SET closing_date = CURRENT_TIMESTAMP WHERE res_id = ?", array($arr_id[$i]));
}
$_SESSION['indexing']['category_id'] = 'outgoing';
return array(
'result' => $result,
'history_msg' => '',
'page_result' => $_SESSION['config']['businessappurl']
. 'index.php?page=view_baskets&module=basket&baskets=IndexingBasket'
);
}
<?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 Action : simple confirm
*
* Open a modal box to confirm a status modification. Used by the core (manage_action.php page).
*
* @file
* @author Claire Figueras <dev@maarch.org>
* @date $date$
* @version $Revision$
* @ingroup apps
*/
/**
* $confirm bool false
*/
$confirm = false;
$etapes = array('form');
$frm_width='285px';
$frm_height = 'auto';
function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $coll_id, $mode)
{
$res_id=$values[0];
$db = new Database();
$labelAction = '';
if ($id_action <> '') {
$stmt = $db->query("select label_action from actions where id = ?", array($id_action));
$resAction = $stmt->fetchObject();
$labelAction = functions::show_string($resAction->label_action);
}
$values_str = '';
if (empty($_SESSION['stockCheckbox'])) {
for ($i=0; $i<count($values); $i++) {
$values_str .= $values[$i].', ';
}
} else {
for ($i=0; $i<count($_SESSION['stockCheckbox']); $i++) {
$values_str .= $_SESSION['stockCheckbox'][$i].', ';
}
}
$values_str = preg_replace('/, $/', '', $values_str);
require 'modules/templates/class/templates_controler.php';
$templatesControler = new templates_controler();
$templates = array();
if (is_numeric($res_id)) {
$stmt = $db->query("SELECT destination FROM res_letterbox WHERE res_id = (?)", [$res_id]);
$resultDest = $stmt->fetchObject();
$destination = $resultDest->destination;
} else {
$destination = '';
}
if ($destination <> '') {
$templates = $templatesControler->getAllTemplatesForProcess($destination);
} else {
$templates = $templatesControler->getAllTemplatesForSelect();
}
$frm_str ='<center style="font-size:15px;">'._ACTION_CONFIRM.'<br/><br/><b>'.$labelAction.' ?</b></center><br/>';
if ($_SESSION['current_basket']['id'] != 'IndexingBasket') {
$frm_str .='<b>'._PROCESS_NOTES.':</b><br/>';
$frm_str .= '<select name="templateNotes" id="templateNotes" style="width:98%;margin-bottom: 10px;background-color: White;border: 1px solid #999;color: #666;text-align: left;" '
. 'onchange="addTemplateToNote($(\'templateNotes\').value, \''
. $_SESSION['config']['businessappurl'] . 'index.php?display=true'
. '&module=templates&page=templates_ajax_content_for_notes\');document.getElementById(\'notes\').focus();">';
$frm_str .= '<option value="">' . _SELECT_NOTE_TEMPLATE . '</option>';
for ($i=0; $i<count($templates); $i++) {
if ($templates[$i]['TYPE'] == 'TXT' && ($templates[$i]['TARGET'] == 'notes' || $templates[$i]['TARGET'] == '')) {
$frm_str .= '<option value="';
$frm_str .= $templates[$i]['ID'];
$frm_str .= '">';
$frm_str .= $templates[$i]['LABEL'];
}
$frm_str .= '</option>';
}
$frm_str .= '</select><br />';
$frm_str .= '<textarea placeholder="motif de l\'action (optionnel) ..." style="width:98%;height:60px;resize:none;" name="notes" id="notes" onblur="document.getElementById(\'note_content_to_users\').value=document.getElementById(\'notes\').value;"></textarea>';
}
$frm_str .='<div id="form2" style="border:none;">';
$frm_str .= '<form name="frm_redirect_dep" id="frm_redirect_dep" method="post" class="forms" action="#">';
$frm_str .= '<input type="hidden" name="chosen_action" id="chosen_action" value="end_action" />';
$frm_str .= '<input type="hidden" name="note_content_to_users" id="note_content_to_users" />';
$frm_str .='</form>';
$frm_str .='</div>';
$frm_str .='<div align="center">';
$frm_str .=' <input type="button" name="redirect_dep" value="'._VALIDATE.'" id="redirect_dep" class="button" onclick="valid_action_form( \'frm_redirect_dep\', \''.$path_manage_action.'\', \''. $id_action.'\', \''.$values_str.'\', \''.$table.'\', \''.$module.'\', \''.$coll_id.'\', \''.$mode.'\');" />';
$frm_str .=' <input type="button" name="cancel" id="cancel" class="button" value="'._CANCEL.'" onclick="pile_actions.action_pop();actions_status.action_pop();destroyModal(\'modal_'.$id_action.'\');"/>';
$frm_str .='</div>';
return addslashes($frm_str);
}
function check_form($form_id, $values)
{
return true;
}
function manage_form($arr_id, $history, $id_action, $label_action, $status, $coll_id, $table, $values_form)
{
if (empty($values_form) || count($arr_id) < 1) {
return false;
}
require_once('modules/notes/class/notes_controler.php');
$note = new notes_controler();
$formValues = array();
for ($i=0; $i<count($values_form); $i++) {
$formValue = $values_form[$i];
$id = $formValue['ID'];
$value = $formValue['VALUE'];
$formValues[$id] = $value;
}
$_SESSION['action_error'] = '';
$coll_id = $_SESSION['current_basket']['coll_id'];
# save note
if ($formValues['note_content_to_users'] != '') {
//Add notes
$content_note = $formValues['note_content_to_users'];
$content_note = str_replace(";", ".", $content_note);
$content_note = str_replace("--", "-", $content_note);
foreach ($arr_id as $res_id) {
$note->addNote($res_id, $coll_id, $content_note);
}
}
return array('result' => implode("#", $arr_id), 'history_msg' => '');
}
/**
* Get the value of a given field in the values returned by the form
*
* @param $values Array Values of the form to check
* @param $field String the field
* @return String the value, false if the field is not found
**/
function get_value_fields($values, $field)
{
for ($i=0; $i<count($values); $i++) {
if ($values[$i]['ID'] == $field) {
return $values[$i]['VALUE'];
}
}
return false;
}
<?php
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
* @brief confirm_status_with_update_date
* @author dev <dev@maarch.org>
* @ingroup apps
*/
$confirm = false;
$etapes = array('form');
$frm_width='285px';
$frm_height = 'auto';
function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $coll_id, $mode )
{
$res_id=$values[0];
$db = new Database();
$labelAction = '';
if ($id_action <> '') {
$stmt = $db->query("select label_action from actions where id = ?",array($id_action));
$resAction = $stmt->fetchObject();
$labelAction = functions::show_string($resAction->label_action);
}
$values_str = '';
if (empty($_SESSION['stockCheckbox'])) {
for ($i=0; $i < count($values);$i++) {
$values_str .= $values[$i].', ';
}
} else {
for ($i=0; $i < count($_SESSION['stockCheckbox']);$i++) {
$values_str .= $_SESSION['stockCheckbox'][$i].', ';
}
}
$values_str = preg_replace('/, $/', '', $values_str);
include_once 'modules/templates/class/templates_controler.php';
$templatesControler = new templates_controler();
$templates = array();
$stmt = $db->query("SELECT destination FROM res_letterbox WHERE res_id = (?)", [$res_id]);
$resultDest = $stmt->fetchObject();
$destination = $resultDest->destination;
if ($destination <> '') {
$templates = $templatesControler->getAllTemplatesForProcess($destination);
} else {
$templates = $templatesControler->getAllTemplatesForSelect();
}
$frm_str ='<center style="font-size:15px;">'._ACTION_CONFIRM.'<br/><br/><b>'.strtoupper($labelAction).' ?</b></center><br/>';
$frm_str .='<b>'._PROCESS_NOTES.':</b><br/>';
$frm_str .= '<select name="templateNotes" id="templateNotes" style="width:98%;margin-bottom: 10px;background-color: White;border: 1px solid #999;color: #666;text-align: left;" '
. 'onchange="addTemplateToNote($(\'templateNotes\').value, \''
. $_SESSION['config']['businessappurl'] . 'index.php?display=true'
. '&module=templates&page=templates_ajax_content_for_notes\');document.getElementById(\'notes\').focus();">';
$frm_str .= '<option value="">' . _SELECT_NOTE_TEMPLATE . '</option>';
for ($i=0;$i<count($templates);$i++) {
if ($templates[$i]['TYPE'] == 'TXT' && ($templates[$i]['TARGET'] == 'notes' || $templates[$i]['TARGET'] == '')) {
$frm_str .= '<option value="';
$frm_str .= $templates[$i]['ID'];
$frm_str .= '">';
$frm_str .= $templates[$i]['LABEL'];
}
$frm_str .= '</option>';
}
$frm_str .= '</select><br />';
$frm_str .= '<textarea placeholder="motif de l\'action (optionnel) ..." style="width:98%;height:60px;resize:none;" name="notes" id="notes" onblur="document.getElementById(\'note_content_to_users\').value=document.getElementById(\'notes\').value;"></textarea>';
$frm_str .='<div id="form2" style="border:none;">';
$frm_str .= '<form name="frm_redirect_dep" id="frm_redirect_dep" method="post" class="forms" action="#">';
$frm_str .= '<input type="hidden" name="chosen_action" id="chosen_action" value="end_action" />';
$frm_str .= '<input type="hidden" name="note_content_to_users" id="note_content_to_users" />';
$frm_str .='</form>';
$frm_str .='</div>';
$frm_str .='<div align="center">';
$frm_str .=' <input type="button" name="redirect_dep" value="'._VALIDATE.'" id="redirect_dep" class="button" onclick="valid_action_form( \'frm_redirect_dep\', \''.$path_manage_action.'\', \''. $id_action.'\', \''.$values_str.'\', \''.$table.'\', \''.$module.'\', \''.$coll_id.'\', \''.$mode.'\');" />';
$frm_str .=' <input type="button" name="cancel" id="cancel" class="button" value="'._CANCEL.'" onclick="pile_actions.action_pop();actions_status.action_pop();destroyModal(\'modal_'.$id_action.'\');"/>';
$frm_str .='</div>';
return addslashes($frm_str);
}
function check_form($form_id,$values)
{
return true;
}
function manage_form($arr_id, $history, $id_action, $label_action, $status, $coll_id, $table, $values_form )
{
if(empty($values_form) || count($arr_id) < 1)
return false;
include_once 'modules/notes/class/notes_controler.php';
$note = new notes_controler();
$formValues = array();
for ($i=0; $i<count($values_form); $i++) {
$formValue = $values_form[$i];
$id = $formValue['ID'];
$value = $formValue['VALUE'];
$formValues[$id] = $value;
}
$_SESSION['action_error'] = '';
$result = '';
$coll_id = $_SESSION['current_basket']['coll_id'];
include_once "core/class/class_security.php";
$sec = new security();
$table = $sec->retrieve_table_from_coll($coll_id);
$db = new Database();
//LOOP IF MASS ACTION
foreach ($arr_id as $res_id) {
$result .= $res_id.'#';
//update exp date
$stmt = $db->query("UPDATE res_letterbox SET departure_date = current_timestamp where res_id = ? and departure_date is null", array($res_id));
//save note
if ($formValues['note_content_to_users'] != '') {
//Add notes
$nb_avis = $sequence +1;
$userIdTypist = $_SESSION['user']['UserId'];
$content_note = $formValues['note_content_to_users'];
$content_note = str_replace(";", ".", $content_note);
$content_note = str_replace("--", "-", $content_note);
$content_note = $content_note;
$note->addNote($res_id, $coll_id, $content_note);
}
}
return array('result' => $result, 'history_msg' => '');
}
/**
* Get the value of a given field in the values returned by the form
*
* @param $values Array Values of the form to check
* @param $field String the field
* @return String the value, false if the field is not found
**/
function get_value_fields($values, $field)
{
for ($i=0; $i<count($values);$i++) {
if ($values[$i]['ID'] == $field) {
return $values[$i]['VALUE'];
}
}
return false;
}
?>
<?php
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
*
*/
/**
* @brief Action : mark as read
*
* mark as read a mail so that it doesn't appear anymore in the basket
*
* @file
* @date $date$
* @version $Revision$
* @ingroup apps
*/
/**
* $confirm bool true
*/
$confirm = true;
/**
* $etapes array Contains only one etap, the status modification
*/
$etapes = array('markAsRead');
function manage_markAsRead($arr_id, $history, $id_action, $label_action, $status)
{
$db = new Database();
$result = '';
require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_security.php');
require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php');
$sec = new security();
$ind_coll = $sec->get_ind_collection($_POST['coll_id']);
for ($i=0; $i<count($arr_id);$i++) {
$result .= $arr_id[$i].'#';
$stmt = $db->query("SELECT * FROM res_mark_as_read WHERE res_id = ? AND user_id = ? AND basket_id = ?", array($arr_id[$i], $_SESSION['user']['UserId'], $_SESSION['current_basket']['id']));
$lineExist = false;
while ($result1 = $stmt->fetchObject()) {
$lineExist = true;
}
if (!$lineExist) {
$query = "INSERT INTO res_mark_as_read VALUES(?, ?, ?)";