Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2021-01-22 13:40:08 +01:00
commit 599d69b07c
22 changed files with 368 additions and 174 deletions

View File

@ -531,11 +531,12 @@ if ($object->id > 0)
print '<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('IntracommReportTransportMode');
print '<td>';
if (($action != 'edittransportmode') && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
if (($action != 'edittransportmode') && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
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 '<td>';
$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 '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
}

View File

@ -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 '<div class="float">':
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 '</div>';
}
}

View File

@ -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 '<div class="float">':
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 '</div>';
}
}

View File

@ -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();
});
</script>'."\n";

View File

@ -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 .= '<strong>'.$langs->trans("Example").':</strong><br>';
$tooltip .= '020{000000000} (for internal use)<br>';
$tooltip .= '9771234{00000} (example of ISSN code with prefix 1234)<br>';
$tooltip .= '9791234{00000} (example of ISMN code with prefix 1234)<br>';
$tooltip .= '020{000000000}? (for internal use)<br>';
$tooltip .= '9771234{00000}? (example of ISSN code with prefix 1234)<br>';
$tooltip .= '9791234{00000}? (example of ISMN code with prefix 1234)<br>';
//$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;
}

View File

@ -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;

View File

@ -0,0 +1,20 @@
-- ===================================================================
-- Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
--
-- 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 <https://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_asset_extrafields ADD INDEX idx_asset_extrafields (fk_object);

View File

@ -0,0 +1,20 @@
-- ===================================================================
-- Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
--
-- 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 <https://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_supplier_proposal_extrafields ADD INDEX idx_supplier_proposal_extrafields (fk_object);

View File

@ -0,0 +1,20 @@
-- ===================================================================
-- Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
--
-- 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 <https://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_supplier_proposaldet_extrafields ADD INDEX idx_supplier_proposaldet_extrafields (fk_object);

View File

@ -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:<br><b>{000000}</b> 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. <br><b>{000000+000}</b> same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s. <br><b>{000000@x}</b> 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. <br><b>{dd}</b> day (01 to 31).<br><b>{mm}</b> month (01 to 12).<br><b>{yy}</b>, <b>{yyyy}</b> or <b>{y}</b> year over 2, 4 or 1 numbers. <br>
GenericMaskCodes2=<b>{cccc}</b> the client code on n characters<br><b>{cccc000}</b> 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.<br><b>{tttt}</b> 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.<br>
GenericMaskCodes3=All other characters in the mask will remain intact.<br>Spaces are not allowed.<br>
GenericMaskCodes3=All other characters in the mask will remain intact (except * or ? in 13th position in EAN13).<br>Spaces are not allowed.<br>In EAN13 the last character after the last } in 13th position<br> should be * or ? it will be replaced by the calculated key.<br>
GenericMaskCodes4a=<u>Example on the 99th %s of the third party TheCompany, with date 2007-01-31:</u><br>
GenericMaskCodes4b=<u>Example on third party created on 2007-03-01:</u><br>
GenericMaskCodes4c=<u>Example on product created on 2007-03-01:</u><br>

View File

@ -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:<br><b>{000000}</b> 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.<br><b>{000000+000}</b> idem que précédemment mais un décalage correspondant au nombre à droite du + est appliqué dès la première %s.<br><b>{000000@x}</b> 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. <br><b>{dd}</b> jour (01 à 31).<br><b>{mm}</b> mois (01 à 12).<br><b>{yy}</b>, <b>{yyyy}</b> ou <b>{y}</b> année sur 2, 4 ou 1 chiffres.<br>
GenericMaskCodes2=<b>{cccc}</b> : code client sur n caractères<br><b>{cccc000}</b> : 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.<br><b>{tttt}</b> 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.<br>
GenericMaskCodes3=Tout autre caractère dans le masque sera laissé inchangé.<br>Les espaces ne sont pas permis.<br>
GenericMaskCodes3=Tout autre caractère dans le masque sera laissé inchangé (sauf * ou ? en 13ème position en EAN13).<br>Les espaces ne sont pas permis.<br>En EAN13 le dernier caractère après la dernière } se plaçant en 13ème position<br>devra être * ou ? il sera remplacé par la clé calculée.<br>
GenericMaskCodes4a=<u>Exemple sur la 99eme %s du tiers LaCompanie faite le 31/01/2007:</u><br>
GenericMaskCodes4b=<u>Exemple sur un tiers créé le 31/03/2007 :</u><br>
GenericMaskCodes4c=<u>Exemple sur un produit/service créé le 31/03/2007 :</u><br>

View File

@ -1052,7 +1052,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.$langs->trans("BarcodeValue").'</td><td>';
$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 '<input class="maxwidth100" type="text" name="barcode" value="'.dol_escape_htmltag($tmpcode).'">';
print '</td></tr>';
}
@ -1512,7 +1512,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1);
print '</td><td>'.$langs->trans("BarcodeValue").'</td><td>';
$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 '<input size="40" class="maxwidthonsmartphone" type="text" name="barcode" value="'.dol_escape_htmltag($tmpcode).'">';
print '</td></tr>';
}
@ -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 ? '<div class="warning">'.$langs->trans("SetDefaultBarcodeType").'<div>' : '');
}
print '</td></tr>'."\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 '<form method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -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 {

View File

@ -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&oacute;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&oacute;dulo_Servicios';
}
@ -269,16 +265,16 @@ if ($id > 0 || !empty($ref))
print '<td>'.$langs->trans('Label').'</td>';
print '<td>'.$langs->trans('Qty').'</td>';
print '</td>';
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 '<tr class="oddeven">';
print '<td>'.$productstatic->getNomUrl(1, 'composition').'</td>';
@ -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 '<td>'.$productstatic->getNomUrl(1, '', 24).'</td>';

View File

@ -766,8 +766,7 @@ while ($i < min($num, $limit))
if (!empty($arrayfields['s.nom']['checked']))
{
print '<td class="tdoverflowmax100">';
if ($obj->socid)
{
if ($obj->socid) {
print $socstatic->getNomUrl(1);
} else {
print '&nbsp;';
@ -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 '<td>';
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");

View File

@ -320,10 +320,6 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0)
print '<td>';
print $object->description;
print '</td>';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</tr>';
// Origin country code
@ -332,6 +328,11 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0)
print '<td>';
print getCountry($object->country_id, 0, $db);
print '</td>';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</tr>';
print '</table>';

View File

@ -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)

View File

@ -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 '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans('ParentCompany').'</td>';
if ($action != 'editparentcompany' && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editparentcompany&amp;socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
if ($action != 'editparentcompany' && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editparentcompany&amp;socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
$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 '<tr><td>'.$langs->trans("LinkedToDolibarrMember").'</td>';
print '<td>';
$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 '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
}

View File

@ -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;
}

View File

@ -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 '<tr class="oddeven">';
// Local ID
if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD))
{
if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) {
print '<td>';
print '</td>';
}
@ -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 '</td>';
// Img of credit card
print '<td>';
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 '<span class="fa fa-university fa-2x fa-fw"></span>';
} 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 '<span class="fa fa-university fa-2x fa-fw"></span>';
}
print'</td>';
// Information
print '<td valign="middle">';
if ($src->object == 'card')
{
if ($src->object == 'card') {
print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.'';
print '</td><td>';
if ($src->country)
{
if ($src->country) {
$img = picto_from_langcode($src->country);
print $img ? $img.' ' : '';
print getCountry($src->country, 1);
} else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
} elseif ($src->object == 'source' && $src->type == 'card')
{
} elseif ($src->object == 'source' && $src->type == 'card') {
print '<span class="opacitymedium">'.$src->owner->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.'';
print '</td><td>';
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().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
} elseif ($src->object == 'source' && $src->type == 'sepa_debit')
{
} elseif ($src->object == 'source' && $src->type == 'sepa_debit') {
print 'SEPA debit';
print '</td><td>';
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().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
} elseif ($src->object == 'payment_method' && $src->type == 'card')
{
} elseif ($src->object == 'payment_method' && $src->type == 'card') {
print '<span class="opacitymedium">'.$src->billing_details->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.'';
print '</td><td>';
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().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
} elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit')
{
} elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') {
print 'SEPA debit';
print '</td><td>';
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 '<td class="center" width="50">';
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 '<a href="'.DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id.'&source='.$src->id.'&action=setassourcedefault&token='.newToken().'">';
print img_picto($langs->trans("Default"), 'off');
print '</a>';
@ -1252,8 +1234,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print $hookmanager->resPrint;
// Action column
print '<td class="right nowraponall">';
if ($user->rights->societe->creer)
{
if ($user->rights->societe->creer) {
print '<a href="'.DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id.'&source='.$src->id.'&action=deletecard&token='.newToken().'">';
print img_picto($langs->trans("Delete"), 'delete');
print '</a>';
@ -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 '<tr><td class="opacitymedium" colspan="'.$colspan.'">'.$langs->trans("None").'</td></tr>';
}
print "</table>";

View File

@ -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 '<input type="hidden" name="socid" value="'.$object->id.'" />';
$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 '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'" />';
print '</form>';
@ -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 ' ';
}

View File

@ -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": "<?php echo $appli; ?>",
"icons": [
{
"src": "<?php echo DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png'; ?>",
"sizes": "256x256",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
$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);