From 45aaafd4d68c757ac79ec90b89e5636115941acb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 May 2019 15:25:26 +0200 Subject: [PATCH 01/11] Fix email not set in paybox payment --- htdocs/public/payment/newpayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index bfbde5f9a29..14c7556daa8 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -354,7 +354,7 @@ if ($action == 'dopayment') if ($paymentmethod == 'paybox') { $PRICE=price2num(GETPOST("newamount"),'MT'); - $email=GETPOST("email",'alpha'); + $email=$conf->global->ONLINE_PAYMENT_SENDEMAIL; $thirdparty_id=GETPOST('thirdparty_id', 'int'); $origfulltag=GETPOST("fulltag",'alpha'); From a138c0545732b13687fe4b66d709da33b8965e50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 May 2019 13:28:10 +0200 Subject: [PATCH 02/11] Fix colspan --- htdocs/core/class/html.formfile.class.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index f6efc4ec093..b729ad51fc5 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -688,7 +688,9 @@ class FormFile $out.= ''; $addcolumforpicto=($delallowed || $printer || $morepicto); - $out.= ''; + $colspan = (3+($addcolumforpicto?1:0)); $colspanmore = 0; + + $out.= ''; // Model if (! empty($modellist)) @@ -745,13 +747,17 @@ class FormFile { foreach($hookmanager->hooks['formfile'] as $module) { - if (method_exists($module, 'formBuilddocLineOptions')) $out .= ''; + if (method_exists($module, 'formBuilddocLineOptions')) + { + $colspanmore++; + $out .= ''; + } } } $out.= ''; // Execute hooks - $parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart); + $parameters=array('colspan'=>($colspan+$colspanmore), 'socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''), 'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'modulepart'=>$modulepart); if (is_object($hookmanager)) { $reshook = $hookmanager->executeHooks('formBuilddocOptions', $parameters, $GLOBALS['object']); @@ -848,14 +854,17 @@ class FormFile if (is_object($hookmanager)) { - $parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart,'relativepath'=>$relativepath); + $parameters=array('colspan'=>($colspan+$colspanmore), 'socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart,'relativepath'=>$relativepath); $res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file); if (empty($res)) { $out.= $hookmanager->resPrint; // Complete line $out.= ''; } - else $out = $hookmanager->resPrint; // Replace line + else + { + $out = $hookmanager->resPrint; // Replace all $out + } } } From 71da27f333c68327f81ff3f9ade49f175e87aecd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 May 2019 16:40:06 +0200 Subject: [PATCH 03/11] Add error message --- htdocs/compta/facture/class/facture.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0924eee89e5..e4140357370 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4604,6 +4604,7 @@ class FactureLigne extends CommonInvoiceLine if ($result <= 0) { $this->error='ErrorProductIdDoesNotExists'; + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); return -1; } } From 4596ec7d389692bca0e1233eab7fe027d8da7296 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 May 2019 18:11:15 +0200 Subject: [PATCH 04/11] FIX Use of cron with multicompany --- htdocs/public/cron/cron_run_jobs.php | 94 ++++++++++++++++++++++------ 1 file changed, 75 insertions(+), 19 deletions(-) diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index 57cde107f24..2d093db07b1 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -44,12 +44,16 @@ dol_include_once("/cron/class/cronjob.class.php"); global $langs, $conf; // Language Management -$langs->loadLangs(array("admin", "cron")); +$langs->loadLangs(array("admin", "cron", "dict")); + /* * View */ +// current date +$now=dol_now(); + // Check the key, avoid that a stranger starts cron $key = GETPOST('securitykey','alpha'); if (empty($key)) @@ -75,15 +79,15 @@ $result=$user->fetch('',$userlogin); if ($result < 0) { echo "User Error:".$user->error; - dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_WARNING); + dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); exit; } else { if (empty($user->id)) { - echo " User user login:".$userlogin." do not exists"; - dol_syslog(" User user login:".$userlogin." do not exists", LOG_WARNING); + echo " User login:".$userlogin." do not exists"; + dol_syslog(" User login:".$userlogin." do not exists", LOG_ERR); exit; } } @@ -94,8 +98,7 @@ $id = GETPOST('id','alpha'); // We accept non numeric id. We will filter later. $object = new Cronjob($db); $filter=array(); -if (! empty($id)) -{ +if (! empty($id)) { if (! is_numeric($id)) { echo "Error: Bad value for parameter job id"; @@ -109,7 +112,7 @@ $result = $object->fetch_all('ASC,ASC,ASC','t.priority,t.entity,t.rowid', 0, 0, if ($result<0) { echo "Error: ".$object->error; - dol_syslog("cron_run_jobs.php fetch Error".$object->error, LOG_WARNING); + dol_syslog("cron_run_jobs.php fetch Error".$object->error, LOG_ERR); exit; } @@ -123,37 +126,76 @@ foreach($object->lines as $val) // TODO Duplicate code. This sequence of code must be shared with code into cron_run_jobs.php script. // current date -$now=dol_now(); $nbofjobs=count($qualifiedjobs); $nbofjobslaunchedok=0; $nbofjobslaunchedko=0; if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) { - // Loop over job + $savconf = dol_clone($conf); + + // Loop over job foreach($qualifiedjobs as $line) { - dol_syslog("cron_run_jobs.php cronjobid: ".$line->id, LOG_WARNING); + dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG); + echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label; + + // Force reload of setup for the current entity + if ($line->entity != $conf->entity) + { + dol_syslog("cron_run_jobs.php we work on another entity so we reload user and conf", LOG_DEBUG); + echo " -> we change entity so we reload user and conf"; + + $conf->entity = (empty($line->entity)?1:$line->entity); + $conf->setValues($db); // This make also the $mc->setValues($conf); that reload $mc->sharings - //If date_next_jobs is less of current dat, execute the program, and store the execution time of the next execution in database + // Force recheck that user is ok for the entity to process and reload permission for entity + if ($conf->entity != $user->entity && $user->entity != 0) + { + $result=$user->fetch('', $userlogin, '', 0, $conf->entity); + if ($result < 0) + { + echo "\nUser Error: ".$user->error."\n"; + dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); + exit(-1); + } + else + { + if ($result == 0) + { + echo "\nUser login: ".$userlogin." does not exists for entity ".$conf->entity."\n"; + dol_syslog("User login:".$userlogin." does not exists", LOG_ERR); + exit(-1); + } + } + $user->getrights(); + } + } + + //If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) { - dol_syslog("cron_run_jobs.php:: torun line->datenextrun:".dol_print_date($line->datenextrun,'dayhourtext')." line->dateend:".dol_print_date($line->dateend,'dayhourtext')." now:".dol_print_date($now,'dayhourtext')); - + echo " - qualified"; + + dol_syslog("cron_run_jobs.php line->datenextrun:".dol_print_date($line->datenextrun,'dayhourrfc')." line->datestart:".dol_print_date($line->datestart,'dayhourrfc')." line->dateend:".dol_print_date($line->dateend,'dayhourrfc')." now:".dol_print_date($now,'dayhourrfc')); + $cronjob=new Cronjob($db); $result=$cronjob->fetch($line->id); if ($result<0) { - echo "Error cronjob->fetch: ".$cronjob->error."
\n"; + echo "Error cronjobid: ".$line->id." cronjob->fetch: ".$cronjob->error."\n"; + echo "Failed to fetch job ".$line->id."\n"; dol_syslog("cron_run_jobs.php::fetch Error".$cronjob->error, LOG_ERR); exit; } - // Execut job + // Execute job $result=$cronjob->run_jobs($userlogin); if ($result < 0) { - echo "Error cronjob->run_job: ".$cronjob->error."
\n"; - dol_syslog("cron_run_jobs.php::run_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjobid: ".$line->id." cronjob->run_job: ".$cronjob->error."\n"; + echo "At least one job failed. Go on menu Home-Setup-Admin tools to see result for each job.\n"; + echo "You can also enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; + dol_syslog("cron_run_jobs.php::run_jobs Error".$cronjob->error, LOG_ERR); $nbofjobslaunchedko++; } else @@ -161,16 +203,30 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) $nbofjobslaunchedok++; } + echo " - result of run_jobs = ".$result; + // We re-program the next execution and stores the last execution time for this job $result=$cronjob->reprogram_jobs($userlogin, $now); if ($result<0) { - echo "Error cronjob->reprogram_job: ".$cronjob->error."
\n"; - dol_syslog("cron_run_jobs.php::reprogram_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjobid: ".$line->id." cronjob->reprogram_job: ".$cronjob->error."\n"; + echo "Enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; + dol_syslog("cron_run_jobs.php::reprogram_jobs Error".$cronjob->error, LOG_ERR); exit; } + + echo " - reprogrammed\n"; + } + else + { + echo " - not qualified\n"; + + dol_syslog("cron_run_jobs.php job not qualified line->datenextrun:".dol_print_date($line->datenextrun,'dayhourrfc')." line->datestart:".dol_print_date($line->datestart,'dayhourrfc')." line->dateend:".dol_print_date($line->dateend,'dayhourrfc')." now:".dol_print_date($now,'dayhourrfc')); } } + + $conf = $savconf; + echo "Result: ".($nbofjobs)." jobs - ".($nbofjobslaunchedok+$nbofjobslaunchedko)." launched = ".$nbofjobslaunchedok." OK + ".$nbofjobslaunchedko." KO"; } else From 7964bb12ce147ee6c7a61cdff6a9f0b3993f27e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 May 2019 18:13:33 +0200 Subject: [PATCH 05/11] FIX Use of cron with multicompany --- scripts/cron/cron_run_jobs.php | 48 +++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index a3b7d83684d..635c128a89f 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -28,7 +28,6 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOLOGIN')) define('NOLOGIN','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); $sapi_type = php_sapi_name(); @@ -64,13 +63,14 @@ $userlogin=$argv[2]; $version=DOL_VERSION; $error=0; +// Language Management +$langs->loadLangs(array('main', 'admin', 'cron', 'dict')); /* * Main */ -$langs->loadLangs(array('main', 'dict')); // current date $now=dol_now(); @@ -159,7 +159,7 @@ $result = $object->fetch_all('ASC,ASC,ASC','t.priority,t.entity,t.rowid', 0, 0, if ($result<0) { echo "Error: ".$object->error; - dol_syslog("cron_run_jobs.php:: fetch Error ".$object->error, LOG_ERR); + dol_syslog("cron_run_jobs.php fetch Error ".$object->error, LOG_ERR); exit(-1); } @@ -171,21 +171,55 @@ foreach($object->lines as $val) $qualifiedjobs[] = $val; } -// TODO Duplicate. This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page. +// TODO Duplicate code. This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page. +// current date $nbofjobs=count($qualifiedjobs); $nbofjobslaunchedok=0; $nbofjobslaunchedko=0; if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) { + $savconf = dol_clone($conf); + // Loop over job foreach($qualifiedjobs as $line) { dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG); - echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label; + // Force reload of setup for the current entity + if ($line->entity != $conf->entity) + { + dol_syslog("cron_run_jobs.php we work on another entity so we reload user and conf", LOG_DEBUG); + echo " -> we change entity so we reload user and conf"; + + $conf->entity = (empty($line->entity)?1:$line->entity); + $conf->setValues($db); // This make also the $mc->setValues($conf); that reload $mc->sharings + + // Force recheck that user is ok for the entity to process and reload permission for entity + if ($conf->entity != $user->entity && $user->entity != 0) + { + $result=$user->fetch('', $userlogin, '', 0, $conf->entity); + if ($result < 0) + { + echo "\nUser Error: ".$user->error."\n"; + dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); + exit(-1); + } + else + { + if ($result == 0) + { + echo "\nUser login: ".$userlogin." does not exists for entity ".$conf->entity."\n"; + dol_syslog("User login:".$userlogin." does not exists", LOG_ERR); + exit(-1); + } + } + $user->getrights(); + } + } + //If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) { @@ -219,7 +253,7 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) echo " - result of run_jobs = ".$result; - // we re-program the next execution and stores the last execution time for this job + // We re-program the next execution and stores the last execution time for this job $result=$cronjob->reprogram_jobs($userlogin, $now); if ($result<0) { @@ -238,6 +272,8 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) dol_syslog("cron_run_jobs.php job not qualified line->datenextrun:".dol_print_date($line->datenextrun,'dayhourrfc')." line->datestart:".dol_print_date($line->datestart,'dayhourrfc')." line->dateend:".dol_print_date($line->dateend,'dayhourrfc')." now:".dol_print_date($now,'dayhourrfc')); } } + + $conf = $savconf; } else { From 8510a846f4151c9c4ef8c0527322d9d318be0d06 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 May 2019 19:04:31 +0200 Subject: [PATCH 06/11] Tooltip --- htdocs/bom/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index a2aabaeb81b..da9942fce44 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -81,7 +81,7 @@ if ($nolinesbefore) { print ''; } ?> - trans('ManufacturingEfficiency'); ?> + textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')); ?>   Date: Mon, 27 May 2019 19:22:51 +0200 Subject: [PATCH 07/11] FIX confirmation of mass email sending + option MAILING_NO_USING_PHPMAIL --- htdocs/comm/mailing/card.php | 2 +- htdocs/core/class/CMailFile.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index ce5fff9c543..048f938ea97 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -870,7 +870,7 @@ else } $text.=$langs->trans('ConfirmSendingEmailing').'
'; $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,300); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 330, 600); } } diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 6401d4ce903..4ac221d8111 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -518,7 +518,7 @@ class CMailFile } $sendingmode = $this->sendmode; - if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') + if ($this->context == 'emailing' && ! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // List of sending methods $listofmethods=array(); From 02fc896612ef247d5288ffb459cd9af2304d52f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 May 2019 20:12:33 +0200 Subject: [PATCH 08/11] FIX Even with permission, can't validate leave once validator defined. --- htdocs/holiday/card.php | 75 ++++++++++++++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 13 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 2ac212527b3..6aa78445766 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -67,6 +67,11 @@ if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = ''; * Actions */ +if (GETPOST('cancel', 'alpha')) +{ + $action = ''; +} + // If create a request if ($action == 'create') { @@ -189,7 +194,35 @@ if ($action == 'create') } } -if ($action == 'update') +if ($action == 'update' && GETPOSTISSET('savevalidator') && ! empty($user->rights->holiday->approve)) +{ + $object = new Holiday($db); + $object->fetch($id); + + $object->oldcopy = dol_clone($object); + + $object->fk_validator = GETPOST('valideur', 'int'); + + if ($object->fk_validator != $object->oldcopy->fk_validator) + { + $verif = $object->update($user); + + if ($verif <= 0) + { + setEventMessages($object->error, $object->errors, 'warnings'); + $action='editvalidator'; + } + else + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + } + + $action = ''; +} + +if ($action == 'update' && ! GETPOSTISSET('savevalidator')) { $date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); @@ -1047,9 +1080,9 @@ else { $head=holiday_prepare_head($object); - if ($action == 'edit' && $object->statut == 1) + if (($action == 'edit' && $object->statut == 1) || ($action == 'editvalidator')) { - $edit = true; + if ($action == 'edit' && $object->statut == 1) $edit = true; print '
'."\n"; print ''."\n"; print ''."\n"; @@ -1089,7 +1122,7 @@ else $starthalfday=($object->halfday == -1 || $object->halfday == 2)?'afternoon':'morning'; $endhalfday=($object->halfday == 1 || $object->halfday == 2)?'morning':'afternoon'; - if(!$edit) + if (!$edit) { print ''; print ''.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; @@ -1188,25 +1221,40 @@ else } // Validator - if (!$edit) { + if (!$edit && $action != 'editvalidator') { print ''; print ''; if ($object->statut == 3 || $object->statut == 4) print $langs->trans('ApprovedBy'); else print $langs->trans('ReviewedByCP'); print ''; - print ''.$valideur->getNomUrl(-1).''; + print ''.$valideur->getNomUrl(-1); + $include_users = $object->fetch_users_approver_holiday(); + if (in_array($user->id, $include_users)) + { + print ''.img_edit($langs->trans("Edit")).''; + } + print ''; print ''; } else { print ''; print ''.$langs->trans('ReviewedByCP').''; print ''; $include_users = $object->fetch_users_approver_holiday(); + if (! in_array($object->fk_validator, $include_users)) // Add the current validator to the list to not lose it when editing. + { + $include_users[]=$object->fk_validator; + } if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays"); else { $s=$form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id)), 0, $include_users); print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); } + if ($action == 'editvalidator') + { + print ''; + print ''; + } print ''; print ''; } @@ -1285,20 +1333,21 @@ else print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleSetToDraft"),$langs->trans("ConfirmSetToDraft"),"confirm_draft", '', 1, 1); } - - if ($action == 'edit' && $object->statut == 1) + if (($action == 'edit' && $object->statut == 1) || ($action == 'editvalidator')) { - print '
'; - if ($cancreate && $object->statut == 1) + if ($action == 'edit' && $object->statut == 1) { - print ''; + print '
'; + if ($cancreate && $object->statut == 1) + { + print ''; + } + print '
'; } - print '
'; print '
'; } - if (! $edit) { print '
'; From 991e247e3042ae56d13078da774250b8c2440749 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 May 2019 20:21:50 +0200 Subject: [PATCH 09/11] Fix edit of validator --- htdocs/holiday/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 6aa78445766..e569096e5ff 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1229,7 +1229,7 @@ else print ''; print ''.$valideur->getNomUrl(-1); $include_users = $object->fetch_users_approver_holiday(); - if (in_array($user->id, $include_users)) + if (in_array($user->id, $include_users) && $object->statut != 1) { print ''.img_edit($langs->trans("Edit")).''; } @@ -1247,7 +1247,7 @@ else if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays"); else { - $s=$form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id)), 0, $include_users); + $s=$form->select_dolusers($object->fk_validator, "valideur", (($action == 'editvalidator') ? 0 : 1), ($user->admin ? '' : array($user->id)), 0, $include_users); print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); } if ($action == 'editvalidator') From 2aa19e469ddb5b20e19abb5375275b5e7411fe44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 May 2019 20:23:40 +0200 Subject: [PATCH 10/11] Fix edit validator --- htdocs/holiday/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 4b5e0aba944..11a1d5054b9 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1270,7 +1270,7 @@ else print ''; print ''.$valideur->getNomUrl(-1); $include_users = $object->fetch_users_approver_holiday(); - if (in_array($user->id, $include_users) && $object->statut != 1) + if (is_array($include_users) && in_array($user->id, $include_users) && $object->statut != Holiday::STATUS_DRAFT) { print ''.img_edit($langs->trans("Edit")).''; } From 1ed7c225d75428ba364b8a74ae3a8cb44a8a3b4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 May 2019 20:25:40 +0200 Subject: [PATCH 11/11] Fix status of holiday --- htdocs/holiday/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 11a1d5054b9..a583f195d02 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1212,7 +1212,7 @@ else print ''.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).''; print ''; - if ($object->statut == 5) + if ($object->statut == Holiday::STATUS_REFUSED) { print ''; print ''.$langs->trans('DetailRefusCP').''; @@ -1265,7 +1265,7 @@ else if (!$edit && $action != 'editvalidator') { print ''; print ''; - if ($object->statut == 3 || $object->statut == 4) print $langs->trans('ApprovedBy'); + if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) print $langs->trans('ApprovedBy'); else print $langs->trans('ReviewedByCP'); print ''; print ''.$valideur->getNomUrl(-1); @@ -1304,19 +1304,19 @@ else print ''.$langs->trans('DateCreateCP').''; print ''.dol_print_date($object->date_create, 'dayhour').''; print ''; - if ($object->statut == 3 || $object->statut == 4) { + if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) { print ''; print ''.$langs->trans('DateValidCP').''; print ''.dol_print_date($object->date_valid, 'dayhour').''; // warning: date_valid is approval date on holiday module print ''; } - if ($object->statut == 4) { + if ($object->statut == Holiday::STATUS_CANCELED) { print ''; print ''.$langs->trans('DateCancelCP').''; print ''.dol_print_date($object->date_cancel, 'dayhour').''; print ''; } - if ($object->statut == 5) { + if ($object->statut == Holiday::STATUS_REFUSED) { print ''; print ''.$langs->trans('DateRefusCP').''; print ''.dol_print_date($object->date_refuse, 'dayhour').'';