-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* new option for elephant * fix typo in comment for codespell check * Update mod_codeclient_elephant.php --------- Co-authored-by: Laurent Destailleur <[email protected]>
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
* Copyright (C) 2011 Juanjo Menent <[email protected]> | ||
* Copyright (C) 2013-2018 Philippe Grand <[email protected]> | ||
* Copyright (C) 2020-2024 Frédéric France <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024 Eric Seigne <[email protected]> | ||
* | ||
* 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 | ||
|
@@ -93,6 +94,8 @@ public function info($langs) | |
$texte .= '<input type="hidden" name="action" value="setModuleOptions">'; | ||
$texte .= '<input type="hidden" name="param1" value="COMPANY_ELEPHANT_MASK_CUSTOMER">'; | ||
$texte .= '<input type="hidden" name="param2" value="COMPANY_ELEPHANT_MASK_SUPPLIER">'; | ||
$texte .= '<input type="hidden" name="param3" value="COMPANY_ELEPHANT_DATE_START">'; | ||
$texte .= '<input type="hidden" name="param4" value="COMPANY_ELEPHANT_DATE_START_ENABLE">'; | ||
$texte .= '<table class="nobordernopadding" width="100%">'; | ||
|
||
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("ThirdParty"), $langs->transnoentities("ThirdParty")); | ||
|
@@ -114,6 +117,33 @@ public function info($langs) | |
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value2" value="'.getDolGlobalString('COMPANY_ELEPHANT_MASK_SUPPLIER').'"'.$disabled.'>', $tooltip, 1, 1).'</td>'; | ||
$texte .= '</tr>'; | ||
|
||
// Date of switch to that numbering model | ||
$datedb = getDolGlobalString('COMPANY_ELEPHANT_DATE_START'); | ||
// After save, default dolibarr store data like displayed : 20/05/2024 and we need a timestamp -> override data | ||
if (!empty($datedb)) { | ||
if (!is_numeric($datedb) && GETPOSTISSET('value3')) { | ||
if (GETPOST('value4') == 1) { | ||
$dateinput = GETPOSTDATE('value3'); | ||
$res = dolibarr_set_const($this->db, 'COMPANY_ELEPHANT_DATE_START', $dateinput, 'chaine', 0, '', $conf->entity); | ||
} else { | ||
$res = dolibarr_set_const($this->db, 'COMPANY_ELEPHANT_DATE_START', '', 'chaine', 0, '', $conf->entity); | ||
} | ||
} else { | ||
$dateinput = $datedb; | ||
} | ||
} | ||
if (empty($dateinput)) { | ||
$dateinput = dol_now(); | ||
} | ||
$texte .= '<tr><td>'.$langs->trans("DateStartThatModel").' ('.$langs->trans("DateStartThatModelHelp").'):</td>'; | ||
$texte .= '<td class="" style="flex-direction: row;display: flex;">'; | ||
$texte .= '<input type="checkbox" onclick="let d=document.getElementById(\'elephantchoosedate\'); if(this.checked){d.style.cssText = \'display: block;\'}else{{d.style.cssText = \'display: none;\'}}" name="value4" value="1" style="float: left;"/>'; | ||
$texte .= '<div style="display: none;" id="elephantchoosedate" class="right">'; | ||
$texte .= $form->selectDate($dateinput, 'value3', 0, 0, 1, '', 1, 1, $disabled ? 1 : 0); | ||
$texte .= '</div>'; | ||
$texte .= '</td>'; | ||
$texte .= '</tr>'; | ||
|
||
$texte .= '</table>'; | ||
$texte .= '</form>'; | ||
|
||
|
@@ -271,6 +301,9 @@ public function verif($db, &$code, $soc, $type) | |
$result = 0; | ||
$code = strtoupper(trim($code)); | ||
|
||
if (getDolGlobalString('COMPANY_ELEPHANT_DATE_START_ENABLE') == 1 && $soc->date_creation < getDolGlobalString('COMPANY_ELEPHANT_DATE_START')) { | ||
return -5; | ||
} | ||
if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED')) { | ||
$result = 0; | ||
} elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED'))) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters