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").''; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 1e3f4080678..07ff1c64dbb 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1259,15 +1259,13 @@ 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) - { + } 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,11 +1273,16 @@ 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); + 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 c05953f498b..5b208f34ff7 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -716,15 +716,13 @@ 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) - { + } 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,11 +730,17 @@ 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); + 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/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3c24df1084c..8e303ac0f1a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7136,12 +7136,36 @@ abstract class CommonObject var parent = $(this).find("option[parent]:first").attr("parent"); var infos = parent.split(":"); var parent_list = infos[0]; + + //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() + } + }); + + //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 + $("#"+child_list).val(0).trigger("change"); + //Hide child lists if the parent value is set to 0 + if ($(this).val() == 0){ + $("#"+child_list).hide(); + } + $("select[name=\""+parent_list+"\"]").change(function() { showOptions(child_list, parent_list, orig_select[child_list]); }); }); } - setListDependencies(); }); '."\n"; diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 3f18d536122..c09239a8d68 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 @@ -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 = ''; + $sql = "SELECT rowid, code, libelle as label"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; + $sql .= " WHERE rowid = '".$db->escape($type)."'"; + $sql .= " AND entity = ".((int) $conf->entity); + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + + if ($num > 0) { + $obj = $db->fetch_object($result); + $out .= $obj->label; //take the label corresponding to the type rowid in the database + } + } + else { + dol_print_error($db); + } + + return $out; + } /** * Return next value * @@ -153,6 +183,11 @@ 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) + + if (empty($type)) { + $type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; + } //get barcode type configuration for products if $type not set // TODO @@ -171,7 +206,28 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $now = dol_now(); $numFinal = get_next_value($db, $mask, 'product', $field, $where, '', $now); - + //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...) + { + $literaltype = ''; + $literaltype = $this->literalBarcodeType($db, $type);//get literal_Barcode_Type + switch ($literaltype) + { + 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; + } + } + //End barcode with key return $numFinal; } 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..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 @@ -30,6 +30,11 @@ -- 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); + +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; @@ -63,21 +68,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 +93,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_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); 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); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index af5b6c52bed..7b94a67e500 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -349,7 +349,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:
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 93eaaea1772..2cff05c65db 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -349,7 +349,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 :
diff --git a/htdocs/product/card.php b/htdocs/product/card.php index e8b8fbdd5a1..c6dfd68d2c4 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1052,7 +1052,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($conf->browser->layout == 'phone') print ''; print ''.$langs->trans("BarcodeValue").''; $tmpcode = GETPOSTISSET('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 ''; } @@ -1512,7 +1512,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); print ''.$langs->trans("BarcodeValue").''; $tmpcode = GETPOSTISSET('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 ''; } @@ -1837,11 +1837,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) 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"; @@ -1857,7 +1861,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($action == 'editbarcode') { $tmpcode = GETPOSTISSET('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 ''; 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).''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index b246d88de93..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,24 +775,20 @@ 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) - { + } 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,10 +796,15 @@ while ($i < min($num, $limit)) $userstatic->statut = $val['statut']; $userstatic->entity = $val['entity']; $userstatic->photo = $val['photo']; - print $userstatic->getNomUrl(1, '', 0, 0, 12); - //print $userstatic->getNomUrl(-2); + $userstatic->login = $val['login']; + $userstatic->phone = $val['phone']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + 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"); diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 0909dd93b8e..13789173094 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -320,10 +320,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 @@ -332,6 +328,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 ''; 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/card.php b/htdocs/societe/card.php index 0d8a92c1cf3..9d145957040 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'); } @@ -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").''; } 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/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 ""; 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 ' '; } diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php index d7f01b3375e..8af5af5a756 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,86 @@ 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);