--- /tmp/dsg/dolibarr/htdocs/core/modules/holiday/github_19.0.3_mod_holiday_immaculate.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/holiday/client_mod_holiday_immaculate.php @@ -34,3 +34,3 @@ - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ @@ -64,2 +64 @@ - * @param Translate $langs Lang object to use for output - * @return string Descriptive text + * @return string text description @@ -67,3 +66,3 @@ - public function info($langs) - { - global $db, $langs; + public function info() + { + global $db, $conf, $langs; @@ -89,2 +88,2 @@ - $texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskholiday" value="'.getDolGlobalString('HOLIDAY_IMMACULATE_MASK').'">', $tooltip, 1, 1).'</td>'; - $texte .= '<td class="left" rowspan="2"> <input type="submit" class="button button-edit reposition smallpaddingimp" name="Button"value="'.$langs->trans("Modify").'"></td>'; + $texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskholiday" value="'.$conf->global->HOLIDAY_IMMACULATE_MASK.'">', $tooltip, 1, 1).'</td>'; + $texte .= '<td class="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; @@ -96 +95 @@ - } + } @@ -103,3 +102,3 @@ - public function getExample() - { - global $conf, $langs, $user; + public function getExample() + { + global $conf, $langs, $user; @@ -107,3 +106,3 @@ - $old_login = $user->login; - $user->login = 'UUUUUUU'; - $numExample = $this->getNextValue($user, ''); + $old_login = $user->login; + $user->login = 'UUUUUUU'; + $numExample = $this->getNextValue($user, ''); @@ -112 +111,2 @@ - if (!$numExample) { + if (!$numExample) + { @@ -116 +116 @@ - } + } @@ -121 +121 @@ - * @param Societe $objsoc third party object + * @param Societe $user user object @@ -125,2 +125,2 @@ - public function getNextValue($objsoc, $holiday) - { + public function getNextValue($user, $holiday) + { @@ -131 +131 @@ - $mask = getDolGlobalString('HOLIDAY_IMMACULATE_MASK'); + $mask = $conf->global->HOLIDAY_IMMACULATE_MASK; @@ -133 +133,2 @@ - if (!$mask) { + if (!$mask) + { @@ -138 +139 @@ - $numFinal = get_next_value($db, $mask, 'holiday', 'ref', '', $objsoc, $holiday->date_create); + $numFinal = get_next_value($db, $mask, 'holiday', 'ref', '', $user, $holiday->date_create); @@ -143 +144 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -151,5 +152,5 @@ - public function holiday_get_num($fuser, $objforref) - { - // phpcs:enable - return $this->getNextValue($fuser, $objforref); - } + public function holiday_get_num($fuser, $objforref) + { + // phpcs:enable + return $this->getNextValue($fuser, $objforref); + } --- /tmp/dsg/dolibarr/htdocs/core/modules/holiday/github_19.0.3_mod_holiday_madonna.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/holiday/client_mod_holiday_madonna.php @@ -3 +3 @@ - * Copyright (C) 2018-2023 Charlene Benke <charlene@patas-monkey.com> + * Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com> @@ -33,3 +33,3 @@ - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ @@ -66,2 +66 @@ - * @param Translate $langs Lang object to use for output - * @return string Descriptive text + * @return string text description @@ -69,5 +68,5 @@ - public function info($langs) - { - global $langs; - return $langs->trans("SimpleNumRefModelDesc", $this->prefix); - } + public function info() + { + global $langs; + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); + } @@ -90,2 +89 @@ - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok + * @return boolean false if conflit, true if ok @@ -93 +91 @@ - public function canBeActivated($object) + public function canBeActivated() @@ -97,2 +95 @@ - $coyymm = ''; - $max = ''; + $coyymm = ''; $max = ''; @@ -107 +104,2 @@ - if ($resql) { + if ($resql) + { @@ -109,4 +107 @@ - if ($row) { - $coyymm = substr($row[0], 0, 6); - $max = $row[0]; - } + if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; } @@ -114 +109,2 @@ - if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { + if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) + { @@ -141 +137,2 @@ - if ($resql) { + if ($resql) + { @@ -143,6 +140,5 @@ - if ($obj) { - $max = intval($obj->max); - } else { - $max = 0; - } - } else { + if ($obj) $max = intval($obj->max); + else $max = 0; + } + else + { @@ -154 +150 @@ - $yymm = dol_print_date($date, "%y%m"); + $yymm = strftime("%y%m", $date); @@ -156,5 +152,2 @@ - if ($max >= (pow(10, 4) - 1)) { - $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is - } else { - $num = sprintf("%04s", $max + 1); - } + if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is + else $num = sprintf("%04s", $max + 1); @@ -167 +160 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -177 +170 @@ - // phpcs:enable + // phpcs:enable --- /tmp/dsg/dolibarr/htdocs/core/modules/holiday/github_19.0.3_modules_holiday.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/holiday/client_modules_holiday.php @@ -33,2 +33 @@ -require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; @@ -42 +40,0 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -43,0 +42,7 @@ + * @var string Error code (or message) + */ + public $error = ''; + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** @@ -46,4 +51,4 @@ - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates - */ + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates + */ @@ -52 +57,3 @@ - // phpcs:enable + // phpcs:enable + global $conf; + @@ -67 +74 @@ -class ModelNumRefHolidays extends CommonNumRefGenerator +class ModelNumRefHolidays @@ -69 +76,78 @@ - // No overload code + /** + * @var string Error code (or message) + */ + public $error = ''; + + /** + * Return if a module can be used or not + * + * @return boolean true if module can be used + */ + public function isEnabled() + { + return true; + } + + /** + * Return default description of numbering model + * + * @return string text description + */ + public function info() + { + global $langs; + $langs->load("holiday"); + return $langs->trans("NoDescription"); + } + + /** + * Return numbering example + * + * @return string Example + */ + public function getExample() + { + global $langs; + $langs->load("holiday"); + return $langs->trans("NoExample"); + } + + /** + * Test if existing numbers make problems with numbering + * + * @return boolean false if conflict, true if ok + */ + public function canBeActivated() + { + return true; + } + + /** + * Return next value + * + * @param Societe $objsoc third party object + * @param Object $contract contract object + * @return string Value + */ + public function getNextValue($objsoc, $contract) + { + global $langs; + return $langs->trans("NotAvailable"); + } + + /** + * Return numbering version module + * + * @return string Value + */ + public function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'development') return $langs->trans("VersionDevelopment"); + elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("NotAvailable"); + }