From 4e95108eb04ea80c95a79f046caa2caa58d58d1b Mon Sep 17 00:00:00 2001 From: zuiko Date: Wed, 6 Jan 2021 23:33:04 +0100 Subject: [PATCH 01/34] Update mod_barcode_product_standard.php Fix #15633 --- .../barcode/mod_barcode_product_standard.php | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 5b561f90c1c..ce9cae8dd1d 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -99,9 +99,9 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("BarCode"), $langs->transnoentities("BarCode")); $tooltip .= $langs->trans("GenericMaskCodes3"); $tooltip .= ''.$langs->trans("Example").':
'; - $tooltip .= '020{000000000} (for internal use)
'; - $tooltip .= '9771234{00000} (example of ISSN code with prefix 1234)
'; - $tooltip .= '9791234{00000} (example of ISMN code with prefix 1234)
'; + $tooltip .= '020{000000000}* (for internal use)
'; + $tooltip .= '9771234{00000}* (example of ISSN code with prefix 1234)
'; + $tooltip .= '9791234{00000}* (example of ISMN code with prefix 1234)
'; //$tooltip.=$langs->trans("GenericMaskCodes5"); // Mask parameter @@ -153,7 +153,8 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode global $db, $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - + require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // to be able to call function barcode_gen_ean_sum($ean) + // TODO // Get Mask value @@ -171,7 +172,22 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $now = dol_now(); $numFinal = get_next_value($db, $mask, 'product', $field, $where, '', $now); - + //if EAN13 calculate and substitute the last 13th character (* or ?) used in the mask by the EAN13 key + $type=$conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; //get barcode type configuration for products + if ($type==2) //2 = EAN13 + { + if (strlen($numFinal)==13) + { + if ((substr($numFinal, -1)=='*') or (substr($numFinal, -1)=='?')) // if last mask character is * or ? + { + $ean = substr($numFinal, 0, 12); //take first 12 digits + $eansum = barcode_gen_ean_sum($ean); + $ean .= $eansum; //substitute the last character by the key + $numFinal = $ean; + } + } + } + //EAN13 end return $numFinal; } From e861248af8058657cd748391add0b8420d2c1645 Mon Sep 17 00:00:00 2001 From: zuiko Date: Wed, 6 Jan 2021 23:37:58 +0100 Subject: [PATCH 02/34] Update admin.lang Fix #15633 --- htdocs/langs/fr_FR/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index c4025fb1577..c6afd025e5b 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -342,7 +342,7 @@ UpdateServerOffline=Serveur de mise à jour hors ligne WithCounter=Gérer un compteur GenericMaskCodes=Vous pouvez saisir tout masque de numérotation. Dans ce masque, les balises suivantes peuvent être utilisées:
{000000} correspond à un numéro qui sera incrémenté à chaque %s. Mettre autant de zéro que la longueur désirée du compteur. Le compteur sera complété par des 0 à gauche afin d'avoir autant de zéro que dans le masque.
{000000+000} idem que précédemment mais un décalage correspondant au nombre à droite du + est appliqué dès la première %s.
{000000@x} idem que précédemment mais le compteur est remis à zéro le xème mois de l'année (x entre 1 et 12, ou 0 pour utiliser le mois de début d'exercice fiscal défini dans votre configuration, ou 99 pour remise à zéro chaque mois). Si cette option est utilisée et x vaut 2 ou plus, alors la séquence {yy}{mm} ou {yyyy}{mm} est obligatoire.
{dd} jour (01 à 31).
{mm} mois (01 à 12).
{yy}, {yyyy} ou {y} année sur 2, 4 ou 1 chiffres.
GenericMaskCodes2={cccc} : code client sur n caractères
{cccc000} : code client sur n caractères suivi d'un compteur propre au client. Ce compteur propre au client est remis à zéro en même temps que le compteur général.
{tttt} code du type de tiers sur n caractères (Voir menu Accueil > Configuration > Dictionnaires > Types de tiers). Si vous ajoutez cet élément au masque de numérotation, le compteur sera différent pour chaque type de tiers.
-GenericMaskCodes3=Tout autre caractère dans le masque sera laissé inchangé.
Les espaces ne sont pas permis.
+GenericMaskCodes3=Tout autre caractère dans le masque sera laissé inchangé (sauf * ou ? en 13ème position en EAN13).
Les espaces ne sont pas permis.
En EAN13 le dernier caractère après la dernière } se plaçant en 13ème position
devra être * ou ? il sera remplacé par la clé calculée.
GenericMaskCodes4a=Exemple sur la 99eme %s du tiers LaCompanie faite le 31/01/2007:
GenericMaskCodes4b=Exemple sur un tiers créé le 31/03/2007 :
GenericMaskCodes4c=Exemple sur un produit/service créé le 31/03/2007 :
From 2300c040b3f12db648a9ea755d8e280491295caf Mon Sep 17 00:00:00 2001 From: zuiko Date: Wed, 6 Jan 2021 23:40:27 +0100 Subject: [PATCH 03/34] Update admin.lang --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 431ef75ac63..5509b0c84c8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -343,7 +343,7 @@ UpdateServerOffline=Update server offline WithCounter=Manage a counter GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags could be used:
{000000} corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask.
{000000+000} same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s.
{000000@x} same as previous but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then sequence {yy}{mm} or {yyyy}{mm} is also required.
{dd} day (01 to 31).
{mm} month (01 to 12).
{yy}, {yyyy} or {y} year over 2, 4 or 1 numbers.
GenericMaskCodes2={cccc} the client code on n characters
{cccc000} the client code on n characters is followed by a counter dedicated for customer. This counter dedicated to customer is reset at same time than global counter.
{tttt} The code of third party type on n characters (see menu Home - Setup - Dictionary - Types of third parties). If you add this tag, the counter will be different for each type of third party.
-GenericMaskCodes3=All other characters in the mask will remain intact.
Spaces are not allowed.
+GenericMaskCodes3=All other characters in the mask will remain intact (except * or ? in 13th position in EAN13).
Spaces are not allowed.
In EAN13 the last character after the last } in 13th position
should be * or ? it will be replaced by the calculated key.
GenericMaskCodes4a=Example on the 99th %s of the third party TheCompany, with date 2007-01-31:
GenericMaskCodes4b=Example on third party created on 2007-03-01:
GenericMaskCodes4c=Example on product created on 2007-03-01:
From 07ddb1fd2b00f12bdd768d77d2a9496a556b2b11 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 6 Jan 2021 23:17:16 +0000 Subject: [PATCH 04/34] Fixing style errors. --- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index ce9cae8dd1d..78ef63724c8 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -154,7 +154,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // to be able to call function barcode_gen_ean_sum($ean) - + // TODO // Get Mask value From 73e69f83897c677901da21db4b0cbb5162b9dcbe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Jan 2021 10:23:38 +0100 Subject: [PATCH 05/34] Update mod_barcode_product_standard.php --- .../core/modules/barcode/mod_barcode_product_standard.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 78ef63724c8..6ba20997b47 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -99,9 +99,9 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("BarCode"), $langs->transnoentities("BarCode")); $tooltip .= $langs->trans("GenericMaskCodes3"); $tooltip .= ''.$langs->trans("Example").':
'; - $tooltip .= '020{000000000}* (for internal use)
'; - $tooltip .= '9771234{00000}* (example of ISSN code with prefix 1234)
'; - $tooltip .= '9791234{00000}* (example of ISMN code with prefix 1234)
'; + $tooltip .= '020{000000000}? (for internal use)
'; + $tooltip .= '9771234{00000}? (example of ISSN code with prefix 1234)
'; + $tooltip .= '9791234{00000}? (example of ISMN code with prefix 1234)
'; //$tooltip.=$langs->trans("GenericMaskCodes5"); // Mask parameter From bcff65c3d33ec21652f0e3ce9aa6495426a23e2d Mon Sep 17 00:00:00 2001 From: zuiko Date: Sat, 9 Jan 2021 01:01:14 +0100 Subject: [PATCH 06/34] Update mod_barcode_product_standard.php get barcode type configuration for products only if $type not set --- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 6ba20997b47..a4c56928688 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -173,7 +173,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $numFinal = get_next_value($db, $mask, 'product', $field, $where, '', $now); //if EAN13 calculate and substitute the last 13th character (* or ?) used in the mask by the EAN13 key - $type=$conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; //get barcode type configuration for products + if ($type=='') {$type=$conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;} //get barcode type configuration for products if $type not set if ($type==2) //2 = EAN13 { if (strlen($numFinal)==13) From 50461931b0604f06a0b77d24e399ac7aa392ae93 Mon Sep 17 00:00:00 2001 From: zuiko Date: Sat, 9 Jan 2021 01:13:02 +0100 Subject: [PATCH 07/34] Update card.php $type replaced by $fk_barcode_type in $tmpcode = $modBarCodeProduct->getNextValue($object, $type); in order to set it --- htdocs/product/card.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d6f62b34769..4a964250cfd 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1052,7 +1052,7 @@ else if ($conf->browser->layout == 'phone') print ''; print ''.$langs->trans("BarcodeValue").''; $tmpcode = isset($_POST['barcode']) ?GETPOST('barcode') : $object->barcode; - if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) $tmpcode = $modBarCodeProduct->getNextValue($object, $type); + if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) $tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type); print ''; print ''; } @@ -1491,7 +1491,7 @@ else print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); print ''.$langs->trans("BarcodeValue").''; $tmpcode = isset($_POST['barcode']) ?GETPOST('barcode') : $object->barcode; - if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) $tmpcode = $modBarCodeProduct->getNextValue($object, $type); + if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) $tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type); print ''; print ''; } @@ -1805,13 +1805,16 @@ else require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $formbarcode = new FormBarCode($db); } + $fk_barcode_type=''; if ($action == 'editbarcodetype') { print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type'); + $fk_barcode_type=$object->barcode_type; } else { $object->fetch_barcode(); + $fk_barcode_type = $object->barcode_type; print $object->barcode_type_label ? $object->barcode_type_label : ($object->barcode ? '
'.$langs->trans("SetDefaultBarcodeType").'
' : ''); } print ''."\n"; @@ -1827,7 +1830,7 @@ else if ($action == 'editbarcode') { $tmpcode = isset($_POST['barcode']) ?GETPOST('barcode') : $object->barcode; - if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) $tmpcode = $modBarCodeProduct->getNextValue($object, $type); + if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) $tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type); print '
'; print ''; From 5ee97dfd4a6917e512024e12e0093f97280d6bad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Jan 2021 16:27:37 +0100 Subject: [PATCH 08/34] Update mod_barcode_product_standard.php --- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index a4c56928688..0c91f0210f4 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -155,6 +155,10 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // to be able to call function barcode_gen_ean_sum($ean) + if (empty($type)) { + $type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; + } //get barcode type configuration for products if $type not set + // TODO // Get Mask value @@ -173,7 +177,6 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $numFinal = get_next_value($db, $mask, 'product', $field, $where, '', $now); //if EAN13 calculate and substitute the last 13th character (* or ?) used in the mask by the EAN13 key - if ($type=='') {$type=$conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;} //get barcode type configuration for products if $type not set if ($type==2) //2 = EAN13 { if (strlen($numFinal)==13) From f5fa7928cad9e15e351c599cea1e76af8da714e8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 11 Jan 2021 15:29:33 +0000 Subject: [PATCH 09/34] Fixing style errors. --- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 0c91f0210f4..0f7024b13cf 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -155,7 +155,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // to be able to call function barcode_gen_ean_sum($ean) - if (empty($type)) { + if (empty($type)) { $type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } //get barcode type configuration for products if $type not set From e012ce242d692d35914f4b2d51f71b213a583cbf Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 11 Jan 2021 16:17:43 +0000 Subject: [PATCH 10/34] Fixing style errors. --- htdocs/product/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 8ec74ff95ef..fbcf7e5dddf 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1843,10 +1843,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($action == 'editbarcodetype') { print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type'); - $fk_barcode_type = $object->barcode_type; + $fk_barcode_type = $object->barcode_type; } else { $object->fetch_barcode(); - $fk_barcode_type = $object->barcode_type; + $fk_barcode_type = $object->barcode_type; print $object->barcode_type_label ? $object->barcode_type_label : ($object->barcode ? '
'.$langs->trans("SetDefaultBarcodeType").'
' : ''); } print ''."\n"; From ff0679866093847907bacd9164098f44f9c930f6 Mon Sep 17 00:00:00 2001 From: zuiko Date: Tue, 12 Jan 2021 21:14:43 +0100 Subject: [PATCH 11/34] Update mod_barcode_product_standard.php More evolving coding by testing the type of barcode in literal form. Does not change deeply the #15918 correction principle in order to fix bug #15633. --- .../barcode/mod_barcode_product_standard.php | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 4642fde6ccc..3940677e458 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -140,7 +140,37 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode return $examplebarcode; } + /** + * Return literal barcode type code from numerical rowid type of barcode + * + * @param Database $db Database + * @param int $type Type of barcode (EAN, ISBN, ...) as rowid + * @return string + */ + public function literalBarcodeType($db, $type = '') + { + global $conf; + $out = ''; + $this->db = $db; + $sql = "SELECT rowid, code, libelle"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; + $sql .= " WHERE rowid = '".$type."'"; + $sql .= " AND entity = ".$conf->entity; + $result = $this->db->query($sql); + if ($result) { + $num = $this->db->num_rows($result); + + if ($num > 0) { + $obj = $this->db->fetch_object($result); + $out .= $obj->code; + } + } + else { + dol_print_error($this->db); + } + return $out; + } /** * Return next value * @@ -177,7 +207,9 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $numFinal = get_next_value($db, $mask, 'product', $field, $where, '', $now); //if EAN13 calculate and substitute the last 13th character (* or ?) used in the mask by the EAN13 key - if ($type==2) //2 = EAN13 + $literaltype = ''; + $literaltype = $this->literalBarcodeType($db,$type);//get literal_Barcode_Type + if ($literaltype=='EAN13') //EAN13 rowid = 2 { if (strlen($numFinal)==13) { From 14e3be630c91cc3cff4da4783349719c12f48af9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 12 Jan 2021 20:16:34 +0000 Subject: [PATCH 12/34] Fixing style errors. --- .../core/modules/barcode/mod_barcode_product_standard.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 3940677e458..4c384d1611f 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -142,10 +142,10 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode } /** * Return literal barcode type code from numerical rowid type of barcode - * - * @param Database $db Database + * + * @param Database $db Database * @param int $type Type of barcode (EAN, ISBN, ...) as rowid - * @return string + * @return string */ public function literalBarcodeType($db, $type = '') @@ -208,7 +208,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $numFinal = get_next_value($db, $mask, 'product', $field, $where, '', $now); //if EAN13 calculate and substitute the last 13th character (* or ?) used in the mask by the EAN13 key $literaltype = ''; - $literaltype = $this->literalBarcodeType($db,$type);//get literal_Barcode_Type + $literaltype = $this->literalBarcodeType($db, $type);//get literal_Barcode_Type if ($literaltype=='EAN13') //EAN13 rowid = 2 { if (strlen($numFinal)==13) From 364158c35be28e88770545738886ca5e3c26b63a Mon Sep 17 00:00:00 2001 From: zuiko Date: Tue, 12 Jan 2021 21:24:55 +0100 Subject: [PATCH 13/34] Update mod_barcode_product_standard.php Blank line after comment removed... --- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 4c384d1611f..de2b3b7a1b9 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -147,7 +147,6 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode * @param int $type Type of barcode (EAN, ISBN, ...) as rowid * @return string */ - public function literalBarcodeType($db, $type = '') { global $conf; From f718a396d5a5ba0bb433ccf93be31bdd8d9cc1ee Mon Sep 17 00:00:00 2001 From: zuiko Date: Tue, 12 Jan 2021 21:59:09 +0100 Subject: [PATCH 14/34] Update mod_barcode_product_standard.php $out .= $obj->libelle; //take the libelle corresponding to the type rowid in the database Take the libelle instead the code for the litteral value of the barcode type rowid. --- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index de2b3b7a1b9..8b851e0fec1 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -162,7 +162,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode if ($num > 0) { $obj = $this->db->fetch_object($result); - $out .= $obj->code; + $out .= $obj->libelle; //take the libelle corresponding to the type rowid in the database } } else { From 1499998a99f856f8bb95dba1f1a9dbc3091152c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jan 2021 12:17:45 +0100 Subject: [PATCH 15/34] Debug --- .../barcode/mod_barcode_product_standard.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 8b851e0fec1..6de9ed06792 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -151,23 +151,24 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode { global $conf; $out = ''; - $this->db = $db; - $sql = "SELECT rowid, code, libelle"; + + $sql = "SELECT rowid, code, libelle as label"; $sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; - $sql .= " WHERE rowid = '".$type."'"; - $sql .= " AND entity = ".$conf->entity; - $result = $this->db->query($sql); + $sql .= " WHERE rowid = '".$db->escape($type)."'"; + $sql .= " AND entity = ".((int) $conf->entity); + $result = $db->query($sql); if ($result) { - $num = $this->db->num_rows($result); + $num = $db->num_rows($result); if ($num > 0) { - $obj = $this->db->fetch_object($result); - $out .= $obj->libelle; //take the libelle corresponding to the type rowid in the database + $obj = $db->fetch_object($result); + $out .= $obj->label; //take the label corresponding to the type rowid in the database } } else { - dol_print_error($this->db); + dol_print_error($db); } + return $out; } /** From 432d45b2894bef61eb3c9bf8f66038d48d7b007f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 13 Jan 2021 11:19:39 +0000 Subject: [PATCH 16/34] Fixing style errors. --- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 6de9ed06792..c1b6aae2f06 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -151,7 +151,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode { global $conf; $out = ''; - + $sql = "SELECT rowid, code, libelle as label"; $sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; $sql .= " WHERE rowid = '".$db->escape($type)."'"; @@ -168,7 +168,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode else { dol_print_error($db); } - + return $out; } /** From 21fac1ff7ac81b29d591db2f573d976ee967b570 Mon Sep 17 00:00:00 2001 From: zuiko Date: Tue, 19 Jan 2021 11:40:53 +0100 Subject: [PATCH 17/34] Update mod_barcode_product_standard.php Fix #15633: Product creation: EAN13 barcode automatic generation incompatible with EAN13 existing barcode scanning, unusable function. #15918 ok with @eldy Avoid sql call if no joker at the end of mask Treat EAN13 in a more evolutive code form to prepare needs for other barcodes with key --- .../barcode/mod_barcode_product_standard.php | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index c1b6aae2f06..27fc67c8f24 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -206,23 +206,28 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $now = dol_now(); $numFinal = get_next_value($db, $mask, 'product', $field, $where, '', $now); - //if EAN13 calculate and substitute the last 13th character (* or ?) used in the mask by the EAN13 key - $literaltype = ''; - $literaltype = $this->literalBarcodeType($db, $type);//get literal_Barcode_Type - if ($literaltype=='EAN13') //EAN13 rowid = 2 + //Begin barcode with key: for barcode with key (EAN13...) calculate and substitute the last character (* or ?) used in the mask by the key + if ((substr($numFinal, -1)=='*') or (substr($numFinal, -1)=='?')) // if last mask character is * or ? a joker, probably we have to calculate a key as last character (EAN13...) { - if (strlen($numFinal)==13) + $literaltype = ''; + $literaltype = $this->literalBarcodeType($db,$type);//get literal_Barcode_Type + switch ($literaltype) { - if ((substr($numFinal, -1)=='*') or (substr($numFinal, -1)=='?')) // if last mask character is * or ? - { - $ean = substr($numFinal, 0, 12); //take first 12 digits - $eansum = barcode_gen_ean_sum($ean); - $ean .= $eansum; //substitute the last character by the key - $numFinal = $ean; - } + case 'EAN13': //EAN13 rowid = 2 + if (strlen($numFinal)==13)// be sure that the mask length is correct for EAN13 + { + $ean = substr($numFinal, 0, 12); //take first 12 digits + $eansum = barcode_gen_ean_sum($ean); + $ean .= $eansum; //substitute the las character by the key + $numFinal = $ean; + } + break; + // Other barcode cases with key could be written here + default: + break; } } - //EAN13 end + //End barcode with key return $numFinal; } From 0cdd9f864072cddfad0563d68c4e73834e6c6ff3 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 19 Jan 2021 10:43:03 +0000 Subject: [PATCH 18/34] Fixing style errors. --- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 27fc67c8f24..c09239a8d68 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -210,7 +210,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode if ((substr($numFinal, -1)=='*') or (substr($numFinal, -1)=='?')) // if last mask character is * or ? a joker, probably we have to calculate a key as last character (EAN13...) { $literaltype = ''; - $literaltype = $this->literalBarcodeType($db,$type);//get literal_Barcode_Type + $literaltype = $this->literalBarcodeType($db, $type);//get literal_Barcode_Type switch ($literaltype) { case 'EAN13': //EAN13 rowid = 2 @@ -222,7 +222,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $numFinal = $ean; } break; - // Other barcode cases with key could be written here + // Other barcode cases with key could be written here default: break; } From c28ce8d3b4fe55d51ddcb3b574ad3902494f7f6b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 19 Jan 2021 17:52:27 +0100 Subject: [PATCH 19/34] fix bulk email mandatory only if contact creation is needed --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 2f0ae952ba7..1a80d618643 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -402,7 +402,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors'); } - if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { + if (!empty($conf->mailing->enabled) && GETPOST("private", 'int') == 1 && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors'); } From 84985c50655914c094b94c0ba2f4adeea2ffaff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 19 Jan 2021 18:01:30 +0100 Subject: [PATCH 20/34] add status and status_buy --- htdocs/product/class/product.class.php | 6 ++-- htdocs/product/composition/card.php | 41 +++++++++++--------------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3bbae9c2cfe..0436034f863 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4334,6 +4334,7 @@ class Product extends CommonObject public function getFather() { $sql = "SELECT p.rowid, p.label as label, p.ref as ref, pa.fk_product_pere as id, p.fk_product_type, pa.qty, pa.incdec, p.entity"; + $sql .= ", p.tosell as status, p.tobuy as status_buy"; $sql .= " FROM ".MAIN_DB_PREFIX."product_association as pa,"; $sql .= " ".MAIN_DB_PREFIX."product as p"; $sql .= " WHERE p.rowid = pa.fk_product_pere"; @@ -4342,8 +4343,7 @@ class Product extends CommonObject $res = $this->db->query($sql); if ($res) { $prods = array(); - while ($record = $this->db->fetch_array($res)) - { + while ($record = $this->db->fetch_array($res)) { // $record['id'] = $record['rowid'] = id of father $prods[$record['id']]['id'] = $record['rowid']; $prods[$record['id']]['ref'] = $record['ref']; @@ -4352,6 +4352,8 @@ class Product extends CommonObject $prods[$record['id']]['incdec'] = $record['incdec']; $prods[$record['id']]['fk_product_type'] = $record['fk_product_type']; $prods[$record['id']]['entity'] = $record['entity']; + $prods[$record['id']]['status'] = $record['status']; + $prods[$record['id']]['status_buy'] = $record['status_buy']; } return $prods; } else { diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 8459fa3e479..620bd69f60a 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -138,18 +138,17 @@ if ($action == 'search') $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type as type, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql .= ' p.fk_product_type, p.tms as datem, p.tobatch'; + $sql .= ', p.tosell as status, p.tobuy as status_buy'; if (!empty($conf->global->MAIN_MULTILANGS)) $sql .= ', pl.label as labelm, pl.description as descriptionm'; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON p.rowid = cp.fk_product'; if (!empty($conf->global->MAIN_MULTILANGS)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND lang='".($current_lang)."'"; $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; - if ($key != "") - { + if ($key != "") { // For natural search $params = array('p.ref', 'p.label', 'p.description', 'p.note'); // multilang - if (!empty($conf->global->MAIN_MULTILANGS)) - { + if (!empty($conf->global->MAIN_MULTILANGS)) { $params[] = 'pl.label'; $params[] = 'pl.description'; $params[] = 'pl.note'; @@ -159,8 +158,7 @@ if ($action == 'search') } $sql .= natural_search($params, $key); } - if (!empty($conf->categorie->enabled) && !empty($parent) && $parent != -1) - { + if (!empty($conf->categorie->enabled) && !empty($parent) && $parent != -1) { $sql .= " AND cp.fk_categorie ='".$db->escape($parent)."'"; } $sql .= " ORDER BY p.ref ASC"; @@ -171,13 +169,11 @@ if ($action == 'search') $title = $langs->trans('ProductServiceCard'); $helpurl = ''; $shortlabel = dol_trunc($object->label, 16); -if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) -{ +if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) { $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('AssociatedProducts'); $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; } -if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) -{ +if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) { $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('AssociatedProducts'); $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } @@ -269,16 +265,16 @@ if ($id > 0 || !empty($ref)) print ''.$langs->trans('Label').''; print ''.$langs->trans('Qty').''; print ''; - if (count($prodsfather) > 0) - { - foreach ($prodsfather as $value) - { + if (count($prodsfather) > 0) { + foreach ($prodsfather as $value) { $idprod = $value["id"]; $productstatic->id = $idprod; // $value["id"]; $productstatic->type = $value["fk_product_type"]; $productstatic->ref = $value['ref']; $productstatic->label = $value['label']; $productstatic->entity = $value['entity']; + $productstatic->status = $value['status']; + $productstatic->status_buy = $value['status_buy']; print ''; print ''.$productstatic->getNomUrl(1, 'composition').''; @@ -532,24 +528,19 @@ if ($id > 0 || !empty($ref)) $prod_arbo = new Product($db); $prod_arbo->id = $objp->rowid; // This type is not supported (not required to have virtual products working). - if ($prod_arbo->type == Product::TYPE_ASSEMBLYKIT || $prod_arbo->type == Product::TYPE_STOCKKIT) - { + if ($prod_arbo->type == Product::TYPE_ASSEMBLYKIT || $prod_arbo->type == Product::TYPE_STOCKKIT) { $is_pere = 0; $prod_arbo->get_sousproduits_arbo(); // associations sousproduits $prods_arbo = $prod_arbo->get_arbo_each_prod(); - if (count($prods_arbo) > 0) - { - foreach ($prods_arbo as $key => $value) - { - if ($value[1] == $id) - { + if (count($prods_arbo) > 0) { + foreach ($prods_arbo as $key => $value) { + if ($value[1] == $id) { $is_pere = 1; } } } - if ($is_pere == 1) - { + if ($is_pere == 1) { $i++; continue; } @@ -563,6 +554,8 @@ if ($id > 0 || !empty($ref)) $productstatic->label = $objp->label; $productstatic->type = $objp->type; $productstatic->entity = $objp->entity; + $productstatic->status = $objp->status; + $productstatic->status_buy = $objp->status_buy; $productstatic->status_batch = $objp->tobatch; print ''.$productstatic->getNomUrl(1, '', 24).''; From 645685d16e5183436d61856be0c0e77bfd77c5c7 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Wed, 20 Jan 2021 18:39:18 +0100 Subject: [PATCH 21/34] FIX : Linked extrafields list --- htdocs/core/class/commonobject.class.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index afb6909c340..f6e21cf5e50 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6568,15 +6568,30 @@ abstract class CommonObject var parent = $(this).find("option[parent]:first").attr("parent"); var infos = parent.split(":"); var parent_list = infos[0]; - showOptions(child_list, parent_list); - - /* Activate the handler to call showOptions on each future change */ + //Hide daughters lists + if ($("#"+child_list).val() == 0 && $("#"+parent_list).val() == 0){ + $("#"+child_list).hide(); + //Show mother lists + } else if ($("#"+parent_list).val() != 0){ + $("#"+parent_list).show(); + } + //show the child list if the parent list value is selected + $("select[name=\""+parent_list+"\"]").click(function() { + if ($(this).val() != 0){ + $("#"+child_list).show() + } + }); $("select[name=\""+parent_list+"\"]").change(function() { showOptions(child_list, parent_list); + //Select the value 0 on child list on change on the parent list + $("#"+child_list).val(0).trigger("change"); + //Hide child lists if the parent value is set to 0 + if ($(this).val() == 0){ + $("#"+child_list).hide(); + } }); }); } - setListDependencies(); }); '."\n"; From 9e5f0a8cb9fb0c87d2cf1fea08f7e23f52028118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 Jan 2021 18:45:44 +0100 Subject: [PATCH 22/34] add more infos in link --- htdocs/comm/propal/list.php | 11 ++++++----- htdocs/contrat/list.php | 10 ++++++---- htdocs/projet/list.php | 11 +++++++---- htdocs/societe/canvas/actions_card_common.class.php | 3 +-- htdocs/societe/class/societe.class.php | 3 ++- htdocs/societe/tpl/linesalesrepresentative.tpl.php | 8 +++++--- 6 files changed, 27 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 1e3f4080678..b01c3820d11 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1262,12 +1262,10 @@ if ($resql) if ($nbofsalesrepresentative > 3) // We print only number { print $nbofsalesrepresentative; - } elseif ($nbofsalesrepresentative > 0) - { + } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($db); $j = 0; - foreach ($listsalesrepresentatives as $val) - { + foreach ($listsalesrepresentatives as $val) { $userstatic->id = $val['id']; $userstatic->lastname = $val['lastname']; $userstatic->firstname = $val['firstname']; @@ -1275,7 +1273,10 @@ if ($resql) $userstatic->statut = $val['statut']; $userstatic->entity = $val['entity']; $userstatic->photo = $val['photo']; - + $userstatic->login = $val['login']; + $userstatic->phone = $val['phone']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; //print '
': print $userstatic->getNomUrl(-2); $j++; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index c05953f498b..3ef8e65a70c 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -719,12 +719,10 @@ while ($i < min($num, $limit)) if ($nbofsalesrepresentative > 3) { // We print only number print $nbofsalesrepresentative; - } elseif ($nbofsalesrepresentative > 0) - { + } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($db); $j = 0; - foreach ($listsalesrepresentatives as $val) - { + foreach ($listsalesrepresentatives as $val) { $userstatic->id = $val['id']; $userstatic->lastname = $val['lastname']; $userstatic->firstname = $val['firstname']; @@ -732,6 +730,10 @@ while ($i < min($num, $limit)) $userstatic->statut = $val['statut']; $userstatic->entity = $val['entity']; $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->phone = $val['phone']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; //print '
': print $userstatic->getNomUrl(-2); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index b246d88de93..5330b6430fd 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -788,12 +788,10 @@ while ($i < min($num, $limit)) if ($nbofsalesrepresentative > 3) // We print only number { print $nbofsalesrepresentative; - } elseif ($nbofsalesrepresentative > 0) - { + } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($db); $j = 0; - foreach ($listsalesrepresentatives as $val) - { + foreach ($listsalesrepresentatives as $val) { $userstatic->id = $val['id']; $userstatic->lastname = $val['lastname']; $userstatic->firstname = $val['firstname']; @@ -801,6 +799,11 @@ while ($i < min($num, $limit)) $userstatic->statut = $val['statut']; $userstatic->entity = $val['entity']; $userstatic->photo = $val['photo']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->phone = $val['phone']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; print $userstatic->getNomUrl(1, '', 0, 0, 12); //print $userstatic->getNomUrl(-2); $j++; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 83309e0faf1..5686b3660d1 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -303,8 +303,7 @@ abstract class ActionsCardCommon if ($nbofsalesrepresentative > 3) // We print only number { $this->tpl['sales_representatives'] .= $nbofsalesrepresentative; - } elseif ($nbofsalesrepresentative > 0) - { + } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($this->db); $i = 0; foreach ($listsalesrepresentatives as $val) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 35e656a83b5..9c8e93b6567 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2197,7 +2197,7 @@ class Societe extends CommonObject $reparray = array(); - $sql = "SELECT DISTINCT u.rowid, u.login, u.lastname, u.firstname, u.office_phone, u.job, u.email, u.statut as status, u.entity, u.photo"; + $sql = "SELECT DISTINCT u.rowid, u.login, u.lastname, u.firstname, u.office_phone, u.job, u.email, u.statut as status, u.entity, u.photo, u.gender"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u"; if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; @@ -2234,6 +2234,7 @@ class Societe extends CommonObject $reparray[$i]['entity'] = $obj->entity; $reparray[$i]['login'] = $obj->login; $reparray[$i]['photo'] = $obj->photo; + $reparray[$i]['gender'] = $obj->gender; } else { $reparray[] = $obj->rowid; } diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php index 4f09bebfe71..1eca5b22623 100644 --- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php +++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php @@ -16,8 +16,7 @@ */ // Protection to avoid direct call of template -if (empty($conf) || !is_object($conf)) -{ +if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit; } @@ -42,7 +41,9 @@ if ($action == 'editsalesrepresentatives') { print ''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); $arrayselected = GETPOST('commercial', 'array'); - if (empty($arrayselected)) $arrayselected = $object->getSalesRepresentatives($user, 1); + if (empty($arrayselected)) { + $arrayselected = $object->getSalesRepresentatives($user, 1); + } print $form->multiselectarray('commercial', $userlist, $arrayselected, null, null, null, null, "90%"); print ''; print ''; @@ -62,6 +63,7 @@ if ($action == 'editsalesrepresentatives') { $userstatic->phone = $val['phone']; $userstatic->job = $val['job']; $userstatic->entity = $val['entity']; + $userstatic->gender = $val['gender']; print $userstatic->getNomUrl(-1); print ' '; } From 96dffb619a1f0d32eaea9456afb4aeb6262d47f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 Jan 2021 18:48:56 +0100 Subject: [PATCH 23/34] add more infos in link --- htdocs/projet/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 5330b6430fd..918d9002904 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -799,7 +799,6 @@ while ($i < min($num, $limit)) $userstatic->statut = $val['statut']; $userstatic->entity = $val['entity']; $userstatic->photo = $val['photo']; - $userstatic->photo = $val['photo']; $userstatic->login = $val['login']; $userstatic->phone = $val['phone']; $userstatic->job = $val['job']; From 118c9ac990055af64e7a946acb9745d4f8da3d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 Jan 2021 21:02:01 +0100 Subject: [PATCH 24/34] add more infos in link --- htdocs/comm/propal/list.php | 10 ++++++---- htdocs/contrat/list.php | 8 +++++--- htdocs/projet/list.php | 20 +++++++++----------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b01c3820d11..07ff1c64dbb 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1259,8 +1259,8 @@ if ($resql) $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); if ($listsalesrepresentatives < 0) dol_print_error($db); $nbofsalesrepresentative = count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 3) // We print only number - { + if ($nbofsalesrepresentative > 6) { + // We print only number print $nbofsalesrepresentative; } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($db); @@ -1278,9 +1278,11 @@ if ($resql) $userstatic->job = $val['job']; $userstatic->gender = $val['gender']; //print '
': - print $userstatic->getNomUrl(-2); + print ($nbofsalesrepresentative < 3) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); $j++; - if ($j < $nbofsalesrepresentative) print ' '; + if ($j < $nbofsalesrepresentative) { + print ' '; + } //print '
'; } } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 3ef8e65a70c..5b208f34ff7 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -716,7 +716,7 @@ while ($i < min($num, $limit)) $listsalesrepresentatives = $socstatic->getSalesRepresentatives($user); if ($listsalesrepresentatives < 0) dol_print_error($db); $nbofsalesrepresentative = count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 3) { + if ($nbofsalesrepresentative > 6) { // We print only number print $nbofsalesrepresentative; } elseif ($nbofsalesrepresentative > 0) { @@ -736,9 +736,11 @@ while ($i < min($num, $limit)) $userstatic->gender = $val['gender']; //print '
': - print $userstatic->getNomUrl(-2); + print ($nbofsalesrepresentative < 3) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); $j++; - if ($j < $nbofsalesrepresentative) print ' '; + if ($j < $nbofsalesrepresentative) { + print ' '; + } //print '
'; } } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 918d9002904..76697359299 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -766,8 +766,7 @@ while ($i < min($num, $limit)) if (!empty($arrayfields['s.nom']['checked'])) { print ''; - if ($obj->socid) - { + if ($obj->socid) { print $socstatic->getNomUrl(1); } else { print ' '; @@ -776,17 +775,15 @@ while ($i < min($num, $limit)) if (!$i) $totalarray['nbfield']++; } // Sales Representatives - if (!empty($arrayfields['commercial']['checked'])) - { + if (!empty($arrayfields['commercial']['checked'])) { print ''; - if ($obj->socid) - { + if ($obj->socid) { $socstatic->id = $obj->socid; $socstatic->name = $obj->name; $listsalesrepresentatives = $socstatic->getSalesRepresentatives($user); $nbofsalesrepresentative = count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 3) // We print only number - { + if ($nbofsalesrepresentative > 6) { + // We print only number print $nbofsalesrepresentative; } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($db); @@ -803,10 +800,11 @@ while ($i < min($num, $limit)) $userstatic->phone = $val['phone']; $userstatic->job = $val['job']; $userstatic->gender = $val['gender']; - print $userstatic->getNomUrl(1, '', 0, 0, 12); - //print $userstatic->getNomUrl(-2); + print ($nbofsalesrepresentative < 3) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); $j++; - if ($j < $nbofsalesrepresentative) print ' '; + if ($j < $nbofsalesrepresentative) { + print ' '; + } } } //else print $langs->trans("NoSalesRepresentativeAffected"); From 1293eb66dbb0e9603cccbe52f304fc5b8bd506aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 Jan 2021 21:25:51 +0100 Subject: [PATCH 25/34] add more infos in link --- htdocs/societe/card.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 0d8a92c1cf3..35670bb252e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2753,11 +2753,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Parent company - if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) - { + if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { print ''; print ''; - if ($action != 'editparentcompany' && $user->rights->societe->creer) print ''; + if ($action != 'editparentcompany' && $user->rights->societe->creer) { + print ''; + } print '
'.$langs->trans('ParentCompany').'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; print ''; $html_name = ($action == 'editparentcompany') ? 'parent_id' : 'none'; @@ -2769,17 +2770,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; // Module Adherent - if (!empty($conf->adherent->enabled)) - { + if (!empty($conf->adherent->enabled)) { $langs->load("members"); print ''.$langs->trans("LinkedToDolibarrMember").''; print ''; $adh = new Adherent($db); $result = $adh->fetch('', '', $object->id); - if ($result > 0) - { + if ($result > 0) { $adh->ref = $adh->getFullName($langs); - print $adh->getNomUrl(1); + print $adh->getNomUrl(-1); } else { print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; } From 55d3eec200c32a234b320656aa8fc96a83575176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 Jan 2021 22:04:24 +0100 Subject: [PATCH 26/34] add more infos in link --- htdocs/comm/card.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 97d61cfdce1..7f4fe6f66c2 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -531,11 +531,12 @@ if ($object->id > 0) print ''; + if (($action != 'edittransportmode') && $user->rights->societe->creer) { + print ''; + } print '
'; print $langs->trans('IntracommReportTransportMode'); print ''; - if (($action != 'edittransportmode') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; print ''; - if ($action == 'edittransportmode') - { + if ($action == 'edittransportmode') { $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'fk_transport_mode', 1); } else { @@ -562,8 +563,7 @@ if ($object->id > 0) include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; // Module Adherent - if (!empty($conf->adherent->enabled)) - { + if (!empty($conf->adherent->enabled)) { $langs->load("members"); $langs->load("users"); @@ -571,10 +571,9 @@ if ($object->id > 0) print ''; $adh = new Adherent($db); $result = $adh->fetch('', '', $object->id); - if ($result > 0) - { + if ($result > 0) { $adh->ref = $adh->getFullName($langs); - print $adh->getNomUrl(1); + print $adh->getNomUrl(-1); } else { print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; } From 01e41a8dddda024815a3e9e27b2e10b68e215bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 Jan 2021 22:40:40 +0100 Subject: [PATCH 27/34] fix colspan too small --- htdocs/societe/paymentmodes.php | 73 ++++++++++++--------------------- 1 file changed, 26 insertions(+), 47 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index deca82df81a..06d0deb8ba3 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1114,22 +1114,21 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $i++; } } - } else dol_print_error($db); + } else { + dol_print_error($db); + } } // Show remote sources (not already shown as local source) - if (is_array($listofsources) && count($listofsources)) - { - foreach ($listofsources as $src) - { + if (is_array($listofsources) && count($listofsources)) { + foreach ($listofsources as $src) { if (!empty($arrayofstripecard[$src->id])) continue; // Already in previous list $nbremote++; print ''; // Local ID - if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) - { + if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) { print ''; print ''; } @@ -1142,8 +1141,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if (!empty($stripeacc)) $connect = $stripeacc.'/'; //$url='https://dashboard.stripe.com/'.$connect.'test/sources/'.$src->id; $url = 'https://dashboard.stripe.com/'.$connect.'test/search?query='.$src->id; - if ($servicestatus) - { + if ($servicestatus) { //$url='https://dashboard.stripe.com/'.$connect.'sources/'.$src->id; $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$src->id; } @@ -1151,73 +1149,58 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; // Img of credit card print ''; - if ($src->object == 'card') - { + if ($src->object == 'card') { print img_credit_card($src->brand); - } elseif ($src->object == 'source' && $src->type == 'card') - { + } elseif ($src->object == 'source' && $src->type == 'card') { print img_credit_card($src->card->brand); - } elseif ($src->object == 'source' && $src->type == 'sepa_debit') - { + } elseif ($src->object == 'source' && $src->type == 'sepa_debit') { print ''; - } elseif ($src->object == 'payment_method' && $src->type == 'card') - { + } elseif ($src->object == 'payment_method' && $src->type == 'card') { print img_credit_card($src->card->brand); - } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') - { + } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { print ''; } print''; // Information print ''; - if ($src->object == 'card') - { + if ($src->object == 'card') { print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.''; print ''; - if ($src->country) - { + if ($src->country) { $img = picto_from_langcode($src->country); print $img ? $img.' ' : ''; print getCountry($src->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } elseif ($src->object == 'source' && $src->type == 'card') - { + } elseif ($src->object == 'source' && $src->type == 'card') { print ''.$src->owner->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print ''; - if ($src->card->country) - { + if ($src->card->country) { $img = picto_from_langcode($src->card->country); print $img ? $img.' ' : ''; print getCountry($src->card->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } elseif ($src->object == 'source' && $src->type == 'sepa_debit') - { + } elseif ($src->object == 'source' && $src->type == 'sepa_debit') { print 'SEPA debit'; print ''; - if ($src->sepa_debit->country) - { + if ($src->sepa_debit->country) { $img = picto_from_langcode($src->sepa_debit->country); print $img ? $img.' ' : ''; print getCountry($src->sepa_debit->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } elseif ($src->object == 'payment_method' && $src->type == 'card') - { + } elseif ($src->object == 'payment_method' && $src->type == 'card') { print ''.$src->billing_details->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print ''; - if ($src->card->country) - { + if ($src->card->country) { $img = picto_from_langcode($src->card->country); print $img ? $img.' ' : ''; print getCountry($src->card->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') - { + } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { print 'SEPA debit'; print ''; - if ($src->sepa_debit->country) - { + if ($src->sepa_debit->country) { $img = picto_from_langcode($src->sepa_debit->country); print $img ? $img.' ' : ''; print getCountry($src->sepa_debit->country, 1); @@ -1229,8 +1212,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // Default print ''; if ((empty($customerstripe->invoice_settings) && $customerstripe->default_source != $src->id) || - (!empty($customerstripe->invoice_settings) && $customerstripe->invoice_settings->default_payment_method != $src->id)) - { + (!empty($customerstripe->invoice_settings) && $customerstripe->invoice_settings->default_payment_method != $src->id)) { print ''; print img_picto($langs->trans("Default"), 'off'); print ''; @@ -1252,8 +1234,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $hookmanager->resPrint; // Action column print ''; - if ($user->rights->societe->creer) - { + if ($user->rights->societe->creer) { print ''; print img_picto($langs->trans("Delete"), 'delete'); print ''; @@ -1264,10 +1245,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } } - if ($nbremote == 0 && $nblocal == 0) - { - $colspan = 8; - if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) $colspan++; + if ($nbremote == 0 && $nblocal == 0) { + $colspan = (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD) ? 10 : 9); print ''.$langs->trans("None").''; } print ""; From 2a195282676b849d60afabcdb98899c8203bc007 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Jan 2021 08:52:10 +0100 Subject: [PATCH 28/34] move extrafield to the end as other acard --- htdocs/resource/card.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index b403c0516f9..750e7435b20 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -338,10 +338,6 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) print ''; print $object->description; print ''; - - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - print ''; // Origin country code @@ -350,6 +346,11 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) print ''; print getCountry($object->country_id, 0, $db); print ''; + + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + print ''; print ''; From 7be25260f314138349131c501991cc3288cd0101 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 21 Jan 2021 10:35:06 +0100 Subject: [PATCH 29/34] Update 13.0.0-14.0.0.sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index b26ac99ad1d..fd65ab02827 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -57,8 +57,8 @@ ALTER TABLE llx_website ADD COLUMN pageviews_total BIGINT UNSIGNED DEFAULT 0; -- Drop foreign key with bad name or not required -ALTER TABLE DROP FOREIGN KEY llx_workstation_workstation_fk_user_creat; -ALTER TABLE DROP FOREIGN KEY llx_propal_fk_warehouse; +ALTER TABLE llx_workstation_workstation DROP FOREIGN KEY llx_workstation_workstation_fk_user_creat; +ALTER TABLE llx_propal DROP FOREIGN KEY llx_propal_fk_warehouse; CREATE TABLE llx_workstation_workstation( From af438624a6cda1888c2a0e3f4a063a155cc39cd3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Jan 2021 13:21:22 +0100 Subject: [PATCH 30/34] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a16c621a1fd..8e303ac0f1a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7151,7 +7151,7 @@ abstract class CommonObject } }); - //When we change parent list + //When we change parent list $("select[name=\""+parent_list+"\"]").change(function() { showOptions(child_list, parent_list, orig_select[child_list]); //Select the value 0 on child list after a change on the parent list From 7888b3d33ea817b0c93b43d880b7203dabf84580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Jan 2021 21:19:03 +0100 Subject: [PATCH 31/34] add missing index in extrafields tables of supplier proposal --- .../install/mysql/migration/13.0.0-14.0.0.sql | 35 ++++++++++--------- .../llx_supplier_proposal_extrafields.key.sql | 20 +++++++++++ ...x_supplier_proposaldet_extrafields.key.sql | 20 +++++++++++ 3 files changed, 59 insertions(+), 16 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_supplier_proposal_extrafields.key.sql create mode 100644 htdocs/install/mysql/tables/llx_supplier_proposaldet_extrafields.key.sql diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index fd65ab02827..a969cbc0564 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -30,6 +30,9 @@ -- Missing in v13 or lower +ALTER TABLE llx_supplier_proposal_extrafields ADD INDEX idx_supplier_proposal_extrafields (fk_object); +ALTER TABLE llx_supplier_proposaldet_extrafields ADD INDEX idx_supplier_proposaldet_extrafields (fk_object); + -- For v14 ALTER TABLE llx_c_availability ADD COLUMN position integer NOT NULL DEFAULT 0; @@ -63,21 +66,21 @@ ALTER TABLE llx_propal DROP FOREIGN KEY llx_propal_fk_warehouse; CREATE TABLE llx_workstation_workstation( -- BEGIN MODULEBUILDER FIELDS - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, ref varchar(128) DEFAULT '(PROV)' NOT NULL, label varchar(255), type varchar(7), note_public text, entity int DEFAULT 1, - note_private text, - date_creation datetime NOT NULL, - tms timestamp, - fk_user_creat integer NOT NULL, - fk_user_modif integer, - import_key varchar(14), - status smallint NOT NULL, - nb_operators_required integer, - thm_operator_estimated double, + note_private text, + date_creation datetime NOT NULL, + tms timestamp, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + import_key varchar(14), + status smallint NOT NULL, + nb_operators_required integer, + thm_operator_estimated double, thm_machine_estimated double -- END MODULEBUILDER FIELDS ) ENGINE=innodb; @@ -88,16 +91,16 @@ ALTER TABLE llx_workstation_workstation ADD CONSTRAINT fk_workstation_workstatio ALTER TABLE llx_workstation_workstation ADD INDEX idx_workstation_workstation_status (status); CREATE TABLE llx_workstation_workstation_resource( - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - tms timestamp, - fk_resource integer, + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + tms timestamp, + fk_resource integer, fk_workstation integer ) ENGINE=innodb; CREATE TABLE llx_workstation_workstation_usergroup( - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - tms timestamp, - fk_usergroup integer, + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + tms timestamp, + fk_usergroup integer, fk_workstation integer ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_supplier_proposal_extrafields.key.sql b/htdocs/install/mysql/tables/llx_supplier_proposal_extrafields.key.sql new file mode 100644 index 00000000000..4f365d85f55 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_supplier_proposal_extrafields.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2021 Frédéric France +-- +-- 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 +-- (at your option) any later version. +-- +-- This program 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 this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_supplier_proposal_extrafields ADD INDEX idx_supplier_proposal_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_supplier_proposaldet_extrafields.key.sql b/htdocs/install/mysql/tables/llx_supplier_proposaldet_extrafields.key.sql new file mode 100644 index 00000000000..278bda52c63 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_supplier_proposaldet_extrafields.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2021 Frédéric France +-- +-- 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 +-- (at your option) any later version. +-- +-- This program 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 this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_supplier_proposaldet_extrafields ADD INDEX idx_supplier_proposaldet_extrafields (fk_object); From c77c5628caa9cd7dfda441981663c77b97086603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Jan 2021 21:35:30 +0100 Subject: [PATCH 32/34] add another missing undex --- .../install/mysql/migration/13.0.0-14.0.0.sql | 2 ++ .../tables/llx_asset_extrafields.key.sql | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_asset_extrafields.key.sql diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index a969cbc0564..287a568c646 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -33,6 +33,8 @@ ALTER TABLE llx_supplier_proposal_extrafields ADD INDEX idx_supplier_proposal_extrafields (fk_object); ALTER TABLE llx_supplier_proposaldet_extrafields ADD INDEX idx_supplier_proposaldet_extrafields (fk_object); +ALTER TABLE llx_asset_extrafields ADD INDEX idx_asset_extrafields (fk_object); + -- For v14 ALTER TABLE llx_c_availability ADD COLUMN position integer NOT NULL DEFAULT 0; diff --git a/htdocs/install/mysql/tables/llx_asset_extrafields.key.sql b/htdocs/install/mysql/tables/llx_asset_extrafields.key.sql new file mode 100644 index 00000000000..fe6bb053ed6 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_extrafields.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2021 Frédéric France +-- +-- 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 +-- (at your option) any later version. +-- +-- This program 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 this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_asset_extrafields ADD INDEX idx_asset_extrafields (fk_object); From 04dc3ae8cd9dabf79a5601a0e3cb06155bd92328 Mon Sep 17 00:00:00 2001 From: ATM john Date: Thu, 21 Jan 2021 21:46:00 +0100 Subject: [PATCH 33/34] NEW : manifest use squared image or custom --- htdocs/theme/eldy/manifest.json.php | 101 +++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 17 deletions(-) diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php index d7f01b3375e..66d5eb45a63 100644 --- a/htdocs/theme/eldy/manifest.json.php +++ b/htdocs/theme/eldy/manifest.json.php @@ -26,7 +26,6 @@ */ if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); -if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); @@ -38,22 +37,90 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require_once __DIR__.'/../../main.inc.php'; -$appli = constant('DOL_APPLICATION_TITLE'); -if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_APPLICATION_TITLE; top_httphead('text/json'); -?> -{ - "name": "", - "icons": [ - { - "src": "", - "sizes": "256x256", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} \ No newline at end of file + +$manifest = new stdClass(); + + +$manifest->name = constant('DOL_APPLICATION_TITLE'); +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $manifest->name = $conf->global->MAIN_APPLICATION_TITLE; + + +$manifest->theme_color = !empty($conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR)?$conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR:'#F05F40'; +$manifest->background_color = !empty($conf->global->MAIN_MANIFEST_APPLI_BG_COLOR)?$conf->global->MAIN_MANIFEST_APPLI_BG_COLOR:"#ffffff"; +$manifest->display = "standalone"; +$manifest->splash_pages = null; +$manifest->icons = array(); + +if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)){ + $icon = new stdClass(); + $icon->src = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL; + if ($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE) { $icon->sizes = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE."x".$conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE; } + else { $icon->sizes = "512x512"; } + $icon->type = "image/png"; + $manifest->icons[] = $icon; +} +elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){ + + if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)){ + $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI; + $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; + if (is_readable($iconPath)) { + $imgSize = getimagesize($iconPath); + if ($imgSize){ + + $icon = new stdClass(); + $icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath); + $icon->sizes = $imgSize[0]."x".$imgSize[1]; + $icon->type = "image/png"; + $manifest->icons[] = $icon; + } + } + } + + if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)){ + $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL; + $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; + if (is_readable($iconPath)) { + $imgSize = getimagesize($iconPath); + if($imgSize){ + + $icon = new stdClass(); + $icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath); + $icon->sizes = $imgSize[0]."x".$imgSize[1]; + $icon->type = "image/png"; + $manifest->icons[] = $icon; + } + } + } + + if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){ + $iconRelativePath = 'logos/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED; + $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; + if (is_readable($iconPath)) { + $imgSize = getimagesize($iconPath); + if($imgSize){ + + $icon = new stdClass(); + $icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath); + $icon->sizes = $imgSize[0]."x".$imgSize[1]; + $icon->type = "image/png"; + $manifest->icons[] = $icon; + } + } + } +} + +// Add Dolibarr std icon +if(empty($manifest->icons)){ + $icon = new stdClass(); + $icon->src = DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png'; + $icon->sizes = "256x256"; + $icon->type = "image/png"; + $manifest->icons[] = $icon; +} + + +print json_encode($manifest); From bb09a39ce6f00f7d90bbe2dabd942af8192e1a46 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 21 Jan 2021 20:52:21 +0000 Subject: [PATCH 34/34] Fixing style errors. --- htdocs/theme/eldy/manifest.json.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php index 66d5eb45a63..8af5af5a756 100644 --- a/htdocs/theme/eldy/manifest.json.php +++ b/htdocs/theme/eldy/manifest.json.php @@ -63,14 +63,12 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)){ $manifest->icons[] = $icon; } elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){ - if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)){ $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI; $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; if (is_readable($iconPath)) { $imgSize = getimagesize($iconPath); if ($imgSize){ - $icon = new stdClass(); $icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath); $icon->sizes = $imgSize[0]."x".$imgSize[1]; @@ -85,8 +83,7 @@ elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){ $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; if (is_readable($iconPath)) { $imgSize = getimagesize($iconPath); - if($imgSize){ - + if ($imgSize){ $icon = new stdClass(); $icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath); $icon->sizes = $imgSize[0]."x".$imgSize[1]; @@ -101,8 +98,7 @@ elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){ $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; if (is_readable($iconPath)) { $imgSize = getimagesize($iconPath); - if($imgSize){ - + if ($imgSize){ $icon = new stdClass(); $icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath); $icon->sizes = $imgSize[0]."x".$imgSize[1]; @@ -114,7 +110,7 @@ elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){ } // Add Dolibarr std icon -if(empty($manifest->icons)){ +if (empty($manifest->icons)){ $icon = new stdClass(); $icon->src = DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png'; $icon->sizes = "256x256";