diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 9a330c7aba5..a60c3fdd8f5 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -1334,4 +1334,74 @@ class Utils return $result; } } + + /** + * Clean unfinished cronjob in processing when pid is no longer present in the system + * CAN BE A CRON TASK + * + * @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK) + * @throws Exception + */ + public function cleanUnfinishedCronjob() + { + global $db, $user; + dol_syslog("Utils::cleanUnfinishedCronjob Starting cleaning"); + + // Import Cronjob class if not present + dol_include_once('/cron/class/cronjob.class.php'); + + // Get this job object + $this_job = new Cronjob($db); + $this_job->fetch(-1, 'Utils', 'cleanUnfinishedCronjob'); + if (empty($this_job->id) || !empty($this_job->error)) { + dol_syslog("Utils::cleanUnfinishedCronjob Unable to fetch himself: ".$this_job->error, LOG_ERR); + return -1; + } + + // Set this job processing to 0 to avoid being locked by his processing state + $this_job->processing = 0; + if ($this_job->update($user) < 0) { + dol_syslog("Utils::cleanUnfinishedCronjob Unable to update himself: ".implode(', ', $this_job->errors), LOG_ERR); + return -1; + } + + $cron_job = new Cronjob($db); + $cron_job->fetchAll('DESC', 't.rowid', 100, 0, 1, '', 1); // Fetch jobs that are currently running + + // Iterate over all jobs in processing (this can't be this job since his state is set to 0 before) + foreach ($cron_job->lines as $job_line) { + // Avoid job with no PID + if (empty($job_line->pid)) { + dol_syslog("Utils::cleanUnfinishedCronjob Cronjob ".$job_line->id." don't have a PID", LOG_DEBUG); + continue; + } + + $job = new Cronjob($db); + $job->fetch($job_line->id); + if (empty($job->id) || !empty($job->error)) { + dol_syslog("Utils::cleanUnfinishedCronjob Cronjob ".$job_line->id." can't be fetch: ".$job->error, LOG_ERR); + continue; + } + + // Calling posix_kill with the 0 kill signal will return true if the process is running, false otherwise. + if (! posix_kill($job->pid, 0)) { + // Clean processing and pid values + $job->processing = 0; + $job->pid = null; + + // Set last result as an error and add the reason on the last output + $job->lastresult = -1; + $job->lastoutput = 'Job killed by job cleanUnfinishedCronjob'; + + if ($job->update($user) < 0) { + dol_syslog("Utils::cleanUnfinishedCronjob Cronjob ".$job_line->id." can't be updated: ".implode(', ', $job->errors), LOG_ERR); + continue; + } + dol_syslog("Utils::cleanUnfinishedCronjob Cronjob ".$job_line->id." cleaned"); + } + } + + dol_syslog("Utils::cleanUnfinishedCronjob Cleaning completed"); + return 0; + } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e76106e44c6..71161d77c64 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -432,8 +432,8 @@ function GETPOSTISSET($paramname) * Can be used before GETPOST to know if the $check param of GETPOST need to check an array or a string * * @param string $paramname Name or parameter to test - * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get) - * @return bool True if we have just submit a POST or GET request with the parameter provided (even if param is empty) + * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get) + * @return bool True if we have just submit a POST or GET request with the parameter provided (even if param is empty) */ function GETPOSTISARRAY($paramname, $method = 0) { diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 290eea449f5..00d73dd7d14 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -101,6 +101,7 @@ class modCron extends DolibarrModules 0=>array('entity'=>0, 'label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'tempfilesold+logfiles', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true), 1=>array('entity'=>0, 'label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>'in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'), 2=>array('entity'=>0, 'label'=>'MakeSendLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'sendDumpDatabase', 'parameters'=>',,,,,sql', 'comment'=>'MakeSendLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>604800, 'priority'=>91, 'status'=>0, 'test'=>'!empty($conf->global->MAIN_ALLOW_BACKUP_BY_EMAIL) && in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'), + 3=>array('entity'=>0, 'label'=>'CleanUnfinishedCronjobShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'cleanUnfinishedCronjob', 'parameters'=>'', 'comment'=>'CleanUnfinishedCronjob', 'frequency'=>5, 'unitfrequency'=>60, 'priority'=>10, 'status'=>0, 'test'=>'getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 2'), // 1=>array('entity'=>0, 'label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) ); diff --git a/htdocs/core/modules/modRecruitment.class.php b/htdocs/core/modules/modRecruitment.class.php index 1d2d614b9ea..ed67430bce5 100644 --- a/htdocs/core/modules/modRecruitment.class.php +++ b/htdocs/core/modules/modRecruitment.class.php @@ -261,7 +261,7 @@ class modRecruitment extends DolibarrModules 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), 'mainmenu'=>'hrm', 'leftmenu'=>'recruitmentjobposition', - 'url'=>'/recruitment/recruitmentindex.php', + 'url'=>'/recruitment/index.php', 'langs'=>'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>1000 + $r, 'enabled'=>'$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index c0e64a513ab..5fbb227bc69 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -146,6 +146,11 @@ if ($action == 'presend') { $formmail->fromname = (!empty($conf->global->ORDER_SUPPLIER_EMAIL_SENDER_NAME) ? $conf->global->ORDER_SUPPLIER_EMAIL_SENDER_NAME : ''); $formmail->fromtype = 'special'; } + if ($object->element === 'recruitmentcandidature' ) { + $formmail->frommail = (!empty($conf->global->RECRUITMENT_EMAIL_SENDER) ? $conf->global->RECRUITMENT_EMAIL_SENDER : $recruitermail); + $formmail->fromname = (!empty($conf->global->RECRUITMENT_EMAIL_SENDER_NAME) ? $conf->global->RECRUITMENT_EMAIL_SENDER_NAME : (!empty($recruitername) ? $recruitername : '')); + $formmail->fromtype = 'special'; + } $formmail->trackid = empty($trackid) ? '' : $trackid; $formmail->inreplyto = empty($inreplyto) ? '' : $inreplyto; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 714622e8014..9bc8400188f 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1140,7 +1140,7 @@ class Cronjob extends CommonObject $this->lastoutput = ''; $this->lastresult = ''; $this->processing = 1; // To know job was started - $this->pid = dol_getmypid(); + $this->pid = function_exists('getmypid') ? getmypid() : null; // Avoid dol_getmypid to get null if the function is not available $this->nbrun = $this->nbrun + 1; $result = $this->update($user); // This include begin/commit if ($result < 0) { diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 0b216df80a1..108f81751b3 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -49,7 +49,7 @@ if (!empty($conf->project->enabled)) { } // Load translation files required by the page -$langs->loadLangs(array("sendings", "bills", 'deliveries', 'orders')); +$langs->loadLangs(array('bills', 'deliveries', 'orders', 'sendings')); if (!empty($conf->incoterm->enabled)) { $langs->load('incoterm'); @@ -89,10 +89,10 @@ $error = 0; */ $parameters = array(); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks // Delete Link $permissiondellink = $user->rights->expedition->delivery->supprimer; // Used by the include of actions_dellink.inc.php -include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once +include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once if ($action == 'add') { $db->begin(); @@ -101,7 +101,7 @@ if ($action == 'add') { $object->note = GETPOST("note", 'restricthtml'); $object->note_private = GETPOST("note", 'restricthtml'); $object->commande_id = GETPOST("commande_id", 'int'); - $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); if (!$conf->expedition_bon->enabled && !empty($conf->stock->enabled)) { $expedition->entrepot_id = GETPOST('entrepot_id', 'int'); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 7c43286ed9f..a87c90a6dd9 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1582,7 +1582,9 @@ class EmailCollector extends CommonObject $plainmsg = $imapemail->getTextBody(); } if ($imapemail->hasAttachments()) { - $attachments = $imapemail->getAttachments(); + $attachments = $imapemail->getAttachments()->all(); + } else { + $attachments = []; } } else { $this->getmsg($connection, $imapemail); @@ -2440,6 +2442,20 @@ class EmailCollector extends CommonObject $errorforactions++; $this->error = 'Failed to create project: '.$langs->trans($projecttocreate->error); $this->errors = $projecttocreate->errors; + } else { + if ($attachments) { + $destdir = $conf->project->dir_output.'/'.$projecttocreate->ref; + if (!dol_is_dir($destdir)) { + dol_mkdir($destdir); + } + if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { + foreach ($attachments as $attachment) { + $attachment->save($destdir.'/'); + } + } else { + $this->getmsg($connection, $imapemail, $destdir); + } + } } } } @@ -2550,13 +2566,16 @@ class EmailCollector extends CommonObject $this->errors = $tickettocreate->errors; } else { if ($attachments) { + $destdir = $conf->ticket->dir_output.'/'.$tickettocreate->ref; + if (!dol_is_dir($destdir)) { + dol_mkdir($destdir); + } if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { - $destdir = $conf->ticket->dir_output.'/'.$tickettocreate->ref; - if (!dol_is_dir($destdir)) { - return -1; - dol_mkdir($destdir); - $this->getmsg($connection, $imapemail, $destdir); + foreach ($attachments as $attachment) { + $attachment->save($destdir.'/'); } + } else { + $this->getmsg($connection, $imapemail, $destdir); } } } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 8d03dbb387c..354c92eb534 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -120,7 +120,7 @@ $search_project_ref = GETPOST('search_project_ref', 'alpha'); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); -if (is_array(GETPOST('search_status', 'none'))) { // 'none' because we want to know type before sanitizing +if (GETPOSTISARRAY('search_status')) { $search_status = join(',', GETPOST('search_status', 'array:intcomma')); } else { $search_status = (GETPOST('search_status', 'intcomma') != '' ? GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma')); diff --git a/htdocs/includes/webklex/php-imap/deleted.txt b/htdocs/includes/webklex/php-imap/deleted.txt index 9993acc6994..7eba7283d76 100644 --- a/htdocs/includes/webklex/php-imap/deleted.txt +++ b/htdocs/includes/webklex/php-imap/deleted.txt @@ -13,4 +13,5 @@ ./vendor/phpdocumentor ./vendor/nesbot/carbon/src/Carbon/Lang ./vendor/doctrine +./vendor/bin ./tests diff --git a/htdocs/includes/webklex/php-imap/vendor/composer/autoload_static.php b/htdocs/includes/webklex/php-imap/vendor/composer/autoload_static.php index db56e4812b6..0120578feb6 100644 --- a/htdocs/includes/webklex/php-imap/vendor/composer/autoload_static.php +++ b/htdocs/includes/webklex/php-imap/vendor/composer/autoload_static.php @@ -16,24 +16,24 @@ class ComposerStaticInit4da13270269c89a28e472e1f7324e6d1 ); public static $prefixLengthsPsr4 = array ( - 'v' => + 'v' => array ( 'voku\\' => 5, ), - 'p' => + 'p' => array ( 'phpDocumentor\\Reflection\\' => 25, ), - 'W' => + 'W' => array ( 'Webmozart\\Assert\\' => 17, 'Webklex\\PHPIMAP\\' => 16, ), - 'T' => + 'T' => array ( - 'Tests\\' => 6, + // 'Tests\\' => 6, ), - 'S' => + 'S' => array ( 'Symfony\\Polyfill\\Php80\\' => 23, 'Symfony\\Polyfill\\Mbstring\\' => 26, @@ -43,115 +43,115 @@ class ComposerStaticInit4da13270269c89a28e472e1f7324e6d1 'Symfony\\Component\\Translation\\' => 30, 'Symfony\\Component\\HttpFoundation\\' => 33, ), - 'P' => + 'P' => array ( 'Psr\\SimpleCache\\' => 16, 'Psr\\Container\\' => 14, 'Prophecy\\' => 9, ), - 'I' => + 'I' => array ( 'Illuminate\\Support\\' => 19, 'Illuminate\\Pagination\\' => 22, 'Illuminate\\Contracts\\' => 21, ), - 'D' => + 'D' => array ( 'Doctrine\\Instantiator\\' => 22, 'Doctrine\\Inflector\\' => 19, ), - 'C' => + 'C' => array ( 'Carbon\\' => 7, ), ); public static $prefixDirsPsr4 = array ( - 'voku\\' => + 'voku\\' => array ( 0 => __DIR__ . '/..' . '/voku/portable-ascii/src/voku', ), - 'phpDocumentor\\Reflection\\' => + 'phpDocumentor\\Reflection\\' => array ( 0 => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src', 1 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src', 2 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src', ), - 'Webmozart\\Assert\\' => + 'Webmozart\\Assert\\' => array ( 0 => __DIR__ . '/..' . '/webmozart/assert/src', ), - 'Webklex\\PHPIMAP\\' => + 'Webklex\\PHPIMAP\\' => array ( 0 => __DIR__ . '/../..' . '/src', ), - 'Tests\\' => + 'Tests\\' => array ( 0 => __DIR__ . '/../..' . '/tests', ), - 'Symfony\\Polyfill\\Php80\\' => + 'Symfony\\Polyfill\\Php80\\' => array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-php80', ), - 'Symfony\\Polyfill\\Mbstring\\' => + 'Symfony\\Polyfill\\Mbstring\\' => array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', ), - 'Symfony\\Polyfill\\Ctype\\' => + 'Symfony\\Polyfill\\Ctype\\' => array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', ), - 'Symfony\\Contracts\\Translation\\' => + 'Symfony\\Contracts\\Translation\\' => array ( 0 => __DIR__ . '/..' . '/symfony/translation-contracts', ), - 'Symfony\\Component\\Yaml\\' => + 'Symfony\\Component\\Yaml\\' => array ( 0 => __DIR__ . '/..' . '/symfony/yaml', ), - 'Symfony\\Component\\Translation\\' => + 'Symfony\\Component\\Translation\\' => array ( 0 => __DIR__ . '/..' . '/symfony/translation', ), - 'Symfony\\Component\\HttpFoundation\\' => + 'Symfony\\Component\\HttpFoundation\\' => array ( 0 => __DIR__ . '/..' . '/symfony/http-foundation', ), - 'Psr\\SimpleCache\\' => + 'Psr\\SimpleCache\\' => array ( 0 => __DIR__ . '/..' . '/psr/simple-cache/src', ), - 'Psr\\Container\\' => + 'Psr\\Container\\' => array ( 0 => __DIR__ . '/..' . '/psr/container/src', ), - 'Prophecy\\' => + 'Prophecy\\' => array ( 0 => __DIR__ . '/..' . '/phpspec/prophecy/src/Prophecy', ), - 'Illuminate\\Support\\' => + 'Illuminate\\Support\\' => array ( 0 => __DIR__ . '/..' . '/illuminate/macroable', 1 => __DIR__ . '/..' . '/illuminate/collections', 2 => __DIR__ . '/..' . '/illuminate/support', ), - 'Illuminate\\Pagination\\' => + 'Illuminate\\Pagination\\' => array ( 0 => __DIR__ . '/..' . '/illuminate/pagination', ), - 'Illuminate\\Contracts\\' => + 'Illuminate\\Contracts\\' => array ( 0 => __DIR__ . '/..' . '/illuminate/contracts', ), - 'Doctrine\\Instantiator\\' => + 'Doctrine\\Instantiator\\' => array ( 0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator', ), - 'Doctrine\\Inflector\\' => + 'Doctrine\\Inflector\\' => array ( 0 => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Inflector', ), - 'Carbon\\' => + 'Carbon\\' => array ( 0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon', ), diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 9705f8823b0..d5f784248be 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -84,6 +84,8 @@ MakeLocalDatabaseDumpShort=Local database backup MakeLocalDatabaseDump=Create a local database dump. Parameters are: compression ('gz' or 'bz' or 'none'), backup type ('mysql', 'pgsql', 'auto'), 1, 'auto' or filename to build, number of backup files to keep MakeSendLocalDatabaseDumpShort=Send local database backup MakeSendLocalDatabaseDump=Send local database backup by email. Parameters are: to, from, subject, message, filename (Name of file sent), filter ('sql' for backup of database only) +CleanUnfinishedCronjobShort=Clean unfinished cronjob +CleanUnfinishedCronjob=Clean cronjob stuck in processing when the process is no longer running WarningCronDelayed=Attention, for performance purpose, whatever is next date of execution of enabled jobs, your jobs may be delayed to a maximum of %s hours, before being run. DATAPOLICYJob=Data cleaner and anonymizer JobXMustBeEnabled=Job %s must be enabled diff --git a/htdocs/langs/en_US/recruitment.lang b/htdocs/langs/en_US/recruitment.lang index 888f6fe5225..1f80ecf1082 100644 --- a/htdocs/langs/en_US/recruitment.lang +++ b/htdocs/langs/en_US/recruitment.lang @@ -57,8 +57,9 @@ EmailRecruiter=Email recruiter ToUseAGenericEmail=To use a generic email. If not defined, the email of the responsible of recruitment will be used NewCandidature=New application ListOfCandidatures=List of applications -RequestedRemuneration=Requested remuneration -ProposedRemuneration=Proposed remuneration +Remuneration=Salary +RequestedRemuneration=Requested salary +ProposedRemuneration=Proposed salary ContractProposed=Contract proposed ContractSigned=Contract signed ContractRefused=Contract refused diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index c42d6d10ff1..060f51ebefe 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -50,7 +50,7 @@ class RecruitmentCandidature extends CommonObject * @var int Does this object support multicompany module ? * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table */ - public $ismultientitymanaged = 0; + public $ismultientitymanaged = 1; /** * @var int Does object support extrafields ? 0=No, 1=Yes diff --git a/htdocs/recruitment/recruitmentindex.php b/htdocs/recruitment/index.php similarity index 99% rename from htdocs/recruitment/recruitmentindex.php rename to htdocs/recruitment/index.php index f028f2f8243..d8c037a22a9 100644 --- a/htdocs/recruitment/recruitmentindex.php +++ b/htdocs/recruitment/index.php @@ -19,7 +19,7 @@ */ /** - * \file recruitment/recruitmentindex.php + * \file recruitment/index.php * \ingroup recruitment * \brief Home page of recruitment top menu */ diff --git a/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php index 759e627bf59..c4ad141bca6 100644 --- a/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php +++ b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php @@ -41,12 +41,12 @@ function recruitmentCandidaturePrepareHead($object) $head[$h][2] = 'card'; $h++; - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - $head[$h][0] = dol_buildpath("/recruitment/recruitmentrating_card.php", 1).'?id='.$object->id; - $head[$h][1] = $langs->trans("Rating"); - $head[$h][2] = 'rating'; - $h++; - } + // if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + // $head[$h][0] = dol_buildpath("/recruitment/recruitmentrating_card.php", 1).'?id='.$object->id; + // $head[$h][1] = $langs->trans("Rating"); + // $head[$h][2] = 'rating'; + // $h++; + // } if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) { $nbNote = 0; diff --git a/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php b/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php index 28e6128452d..4e9b8d33e36 100644 --- a/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php +++ b/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php @@ -42,7 +42,7 @@ function recruitmentjobpositionPrepareHead($object) $h++; $head[$h][0] = dol_buildpath("/recruitment/recruitmentcandidature_list.php", 1).'?id='.$object->id; - $head[$h][1] = $langs->trans("Candidatures"); + $head[$h][1] = $langs->trans("RecruitmentCandidatures"); $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature WHERE fk_recruitmentjobposition = ".((int) $object->id); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/recruitment/recruitmentcandidature_agenda.php b/htdocs/recruitment/recruitmentcandidature_agenda.php index bfe70deb075..067a472e1f8 100644 --- a/htdocs/recruitment/recruitmentcandidature_agenda.php +++ b/htdocs/recruitment/recruitmentcandidature_agenda.php @@ -124,7 +124,7 @@ if (empty($reshook)) { $form = new Form($db); if ($object->id > 0) { - $title = $langs->trans("Agenda"); + $title = $object->ref." - ".$langs->trans('Agenda'); //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'Module_Agenda_En'; llxHeader('', $title, $help_url); diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index b1903edb71f..0a5bd616fd5 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -257,10 +257,15 @@ $form = new Form($db); $formfile = new FormFile($db); $formproject = new FormProjets($db); -$title = $langs->trans("RecruitmentCandidature"); -$help_url = ''; -llxHeader('', $title, $help_url); +if ($action == 'create') { + $title = $langs->trans('NewCandidature'); + $help_url = ''; +} else { + $title = $object->ref." - ".$langs->trans('Card'); + $help_url = ''; +} +llxHeader('', $title, $help_url); // Part to create if ($action == 'create') { @@ -651,6 +656,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $trackid = 'recruitmentcandidature'.$object->id; $inreplyto = $object->email_msgid; + $job = new RecruitmentJobPosition($db); + $job->fetch($object->fk_recruitmentjobposition); + + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + $recruiter = new User($db); + $recruiter->fetch($job->fk_user_recruiter); + + $recruitername = $recruiter->getFullName(''); + $recruitermail = (!empty($job->email_recruiter) ? $job->email_recruiter : $recruiter->email); + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } diff --git a/htdocs/recruitment/recruitmentcandidature_document.php b/htdocs/recruitment/recruitmentcandidature_document.php index cd3da93b9e0..95ce0210303 100644 --- a/htdocs/recruitment/recruitmentcandidature_document.php +++ b/htdocs/recruitment/recruitmentcandidature_document.php @@ -97,9 +97,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; $form = new Form($db); -$title = $langs->trans("RecruitmentJobPosition").' - '.$langs->trans("Files"); +$title = $object->ref." - ".$langs->trans('Files'); $help_url = ''; -//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('', $title, $help_url); if ($object->id) { diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index d64d2e70037..1e3423dfd6c 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -556,7 +556,7 @@ $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); -$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.((int) $id)), '', $permissiontoadd); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&fk_recruitmentjobposition='.$id, '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/recruitment/recruitmentcandidature_note.php b/htdocs/recruitment/recruitmentcandidature_note.php index c6fedf6fcea..a9a14376b94 100644 --- a/htdocs/recruitment/recruitmentcandidature_note.php +++ b/htdocs/recruitment/recruitmentcandidature_note.php @@ -80,9 +80,9 @@ if (empty($reshook)) { $form = new Form($db); -//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'; +$title = $object->ref." - ".$langs->trans('Notes'); $help_url = ''; -llxHeader('', $langs->trans('RecruitmentCandidature'), $help_url); +llxHeader('', $title, $help_url); if ($id > 0 || !empty($ref)) { $object->fetch_thirdparty(); diff --git a/htdocs/recruitment/recruitmentjobposition_agenda.php b/htdocs/recruitment/recruitmentjobposition_agenda.php index 07cecb0070e..df6ff2ed6ad 100644 --- a/htdocs/recruitment/recruitmentjobposition_agenda.php +++ b/htdocs/recruitment/recruitmentjobposition_agenda.php @@ -124,7 +124,7 @@ if (empty($reshook)) { $form = new Form($db); if ($object->id > 0) { - $title = $langs->trans("Agenda"); + $title = $object->ref." - ".$langs->trans('Agenda'); //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = ''; llxHeader('', $title, $help_url); diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index 996868a791e..cf41a06f954 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -177,7 +177,7 @@ $form = new Form($db); $formfile = new FormFile($db); $formproject = new FormProjets($db); -$title = $langs->trans("PositionToBeFilled"); +$title = $object->ref." - ".$langs->trans('Card'); $help_url = ''; llxHeader('', $title, $help_url); diff --git a/htdocs/recruitment/recruitmentjobposition_document.php b/htdocs/recruitment/recruitmentjobposition_document.php index d05ed9ab5d6..ca9907976be 100644 --- a/htdocs/recruitment/recruitmentjobposition_document.php +++ b/htdocs/recruitment/recruitmentjobposition_document.php @@ -97,7 +97,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; $form = new Form($db); -$title = $langs->trans("RecruitmentJobPosition").' - '.$langs->trans("Files"); +$title = $object->ref." - ".$langs->trans('Files'); $help_url = ''; //$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('', $title, $help_url); diff --git a/htdocs/recruitment/recruitmentjobposition_note.php b/htdocs/recruitment/recruitmentjobposition_note.php index c5d8cc29533..bbcced5326a 100644 --- a/htdocs/recruitment/recruitmentjobposition_note.php +++ b/htdocs/recruitment/recruitmentjobposition_note.php @@ -85,9 +85,9 @@ if (empty($reshook)) { $form = new Form($db); -//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'; +$title = $object->ref." - ".$langs->trans('Notes'); $help_url = ''; -llxHeader('', $langs->trans('RecruitmentJobPosition'), $help_url); +llxHeader('', $title, $help_url); if ($id > 0 || !empty($ref)) { $object->fetch_thirdparty(); diff --git a/htdocs/resource/agenda.php b/htdocs/resource/agenda.php index cb13ce78e7d..27edf4457e5 100644 --- a/htdocs/resource/agenda.php +++ b/htdocs/resource/agenda.php @@ -35,12 +35,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php'; require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; // Load translation files required by the page -$langs->load("companies"); +$langs->load('companies'); // Get parameters -$id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -52,6 +52,7 @@ if (GETPOST('actioncode', 'array')) { } else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } + $search_agenda_label = GETPOST('search_agenda_label'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -72,7 +73,7 @@ if (!$sortorder) { } // Initialize technical objects -//$object=new MyObject($db); + $extrafields = new ExtraFields($db); $hookmanager->initHooks(array('agendaresource')); @@ -94,7 +95,7 @@ if (!$user->rights->resource->read) { */ $parameters = array('id'=>$id); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } @@ -126,7 +127,6 @@ if ($object->id > 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - $langs->load("companies"); $picto = 'resource'; $title = $langs->trans("Agenda"); diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index aca47d49743..cf291cce28c 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -1,10 +1,13 @@ * Copyright (C) 2007-2009 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2016 Gilles Poirier - * + */ + +/** * This program 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 @@ -22,7 +25,7 @@ /** * \file htdocs/resource/contact.php * \ingroup resource - * \brief Onglet de gestion des contacts des resources + * \brief Contacts management tab for resources */ require '../main.inc.php'; @@ -32,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; // Load translation files required by the page -$langs->loadLangs(array('resource', 'sendings', 'companies')); +$langs->loadLangs(array('companies', 'resource', 'sendings')); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -41,7 +44,7 @@ $action = GETPOST('action', 'aZ09'); $object = new DolResource($db); // Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Security check if ($user->socid) { @@ -55,10 +58,12 @@ if (!$user->rights->resource->read) { } + /* - * Add a new contact + * Actions */ +// Add a new contact if ($action == 'addcontact' && $user->rights->resource->write) { if ($result > 0 && $id > 0) { $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); @@ -106,7 +111,7 @@ $userstatic = new User($db); llxHeader('', $langs->trans("Resource")); -// Mode vue et edition +// View and edit mode if ($id > 0 || !empty($ref)) { $soc = new Societe($db); diff --git a/htdocs/zapier/admin/setup.php b/htdocs/zapier/admin/setup.php index 0d3cf64c54f..58ede898f17 100644 --- a/htdocs/zapier/admin/setup.php +++ b/htdocs/zapier/admin/setup.php @@ -26,11 +26,11 @@ require '../../main.inc.php'; // Libraries -require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/zapier/lib/zapier.lib.php'; // Translations -$langs->loadLangs(array("admin", "zapier")); +$langs->loadLangs(array('admin', 'zapier')); // Access control if (!$user->admin) { @@ -63,7 +63,7 @@ if ((float) DOL_VERSION >= 6) { * View */ -$page_name = "ZapierForDolibarrSetup"; +$page_name = 'ZapierForDolibarrSetup'; $help_url = 'EN:Module_Zapier'; llxHeader('', $langs->trans($page_name), $help_url); @@ -98,6 +98,7 @@ if ($action == 'edit') { print ''; print '
'; + } else { if (!empty($arrayofparameters)) { print ''; diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php index 5bcab883238..cfb46fb70b9 100644 --- a/htdocs/zapier/class/api_zapier.class.php +++ b/htdocs/zapier/class/api_zapier.class.php @@ -1,4 +1,5 @@ * Copyright (C) 2019-2020 Frédéric France * @@ -16,16 +17,17 @@ * along with this program. If not, see . */ -use Luracast\Restler\RestException; - -require_once DOL_DOCUMENT_ROOT.'/zapier/class/hook.class.php'; - /** * \file htdocs/zapier/class/api_zapier.class.php * \ingroup zapier * \brief File for API management of hook. */ +use Luracast\Restler\RestException; + +require_once DOL_DOCUMENT_ROOT.'/zapier/class/hook.class.php'; + + /** * API class for zapier hook * diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 6388d3985e7..dd0e6827ec1 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -464,7 +464,9 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase //var_dump($val); if (!in_array($val[1], array( "'replacestring'", "'htmlheader'", "'WEBSITE_HTML_HEADER'", "'WEBSITE_CSS_INLINE'", "'WEBSITE_JS_INLINE'", "'WEBSITE_MANIFEST_JSON'", "'PAGE_CONTENT'", "'WEBSITE_README'", - "'search_status'", '"mysqldump"', '"postgresqldump"', "'db_pass_root'", "'db_pass'", '"pass"', '"pass1"', '"pass2"', '"password"', "'password'", '"MAIN_MAIL_SMTPS_PW"'))) { + '"mysqldump"', '"postgresqldump"', + "'db_pass_root'", "'db_pass'", '"pass"', '"pass1"', '"pass2"', '"password"', "'password'", + '"MAIN_MAIL_SMTPS_PW"', '"MAIN_MAIL_SMTPS_PW_EMAILING"', '"MAIN_MAIL_SMTPS_PW_TICKET"'))) { $ok=false; break; }