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

This commit is contained in:
Laurent Destailleur 2021-06-04 11:45:24 +02:00
commit c3ed30345e
8 changed files with 195 additions and 88 deletions

View File

@ -682,7 +682,7 @@ while ($i < min($num, $limit)) {
print "<tr>";
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if ($line->subledger_account != "" && $line->subledger_account != '-1') {
print $object->get_compte_desc($line->numero_compte).' : '.length_accounta($line->subledger_account);
print $line->subledger_label.' : '.length_accounta($line->subledger_account);
} else {
// Should not happen: subledger account must be null or a non empty value
print '<span class="error">'.$langs->trans("Unknown");

View File

@ -8,6 +8,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* 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
@ -246,6 +247,7 @@ if ($action == 'install') {
if ($action == 'set' && $user->admin) {
$resarray = activateModule($value);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
if (!empty($resarray['errors'])) {
setEventMessages('', $resarray['errors'], 'errors');
} else {
@ -269,6 +271,7 @@ if ($action == 'set' && $user->admin) {
exit;
} elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') {
$result = unActivateModule($value);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
if ($result) {
setEventMessages($result, null, 'errors');
}

View File

@ -569,90 +569,194 @@ class FormTicket
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
* @param int $maxlength Max length of label
* @param string $morecss More CSS
* @param int $use_multilevel if != 0 create a multilevel select ( Do not use any of the other params)
* @return void
*/
public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '')
public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $use_multilevel = 0)
{
global $langs, $user;
$ticketstat = new Ticket($this->db);
if ($use_multilevel == 0) {
$ticketstat = new Ticket($this->db);
dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
$ticketstat->loadCacheCategoriesTickets();
$ticketstat->loadCacheCategoriesTickets();
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
if ($empty) {
print '<option value="">&nbsp;</option>';
}
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
if ($empty) {
print '<option value="">&nbsp;</option>';
}
if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) {
foreach ($ticketstat->cache_category_tickets as $id => $arraycategories) {
// Exclude some record
if ($filtertype == 'public=1') {
if (empty($arraycategories['public'])) {
if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) {
foreach ($ticketstat->cache_category_tickets as $id => $arraycategories) {
// Exclude some record
if ($filtertype == 'public=1') {
if (empty($arraycategories['public'])) {
continue;
}
}
// We discard empty line if showempty is on because an empty line has already been output.
if ($empty && empty($arraycategories['code'])) {
continue;
}
if ($format == 0) {
print '<option value="'.$id.'"';
}
if ($format == 1) {
print '<option value="'.$arraycategories['code'].'"';
}
if ($format == 2) {
print '<option value="'.$arraycategories['code'].'"';
}
if ($format == 3) {
print '<option value="'.$id.'"';
}
// Si selected est text, on compare avec code, sinon avec id
if (preg_match('/[a-z]/i', $selected) && $selected == $arraycategories['code']) {
print ' selected="selected"';
} elseif ($selected == $id) {
print ' selected="selected"';
} elseif ($arraycategories['use_default'] == "1" && !$selected && !$empty) {
print ' selected="selected"';
}
print '>';
if ($format == 0) {
$value = ($maxlength ? dol_trunc($arraycategories['label'], $maxlength) : $arraycategories['label']);
}
if ($format == 1) {
$value = $arraycategories['code'];
}
if ($format == 2) {
$value = ($maxlength ? dol_trunc($arraycategories['label'], $maxlength) : $arraycategories['label']);
}
if ($format == 3) {
$value = $arraycategories['code'];
}
print $value ? $value : '&nbsp;';
print '</option>';
}
// We discard empty line if showempty is on because an empty line has already been output.
if ($empty && empty($arraycategories['code'])) {
continue;
}
if ($format == 0) {
print '<option value="'.$id.'"';
}
if ($format == 1) {
print '<option value="'.$arraycategories['code'].'"';
}
if ($format == 2) {
print '<option value="'.$arraycategories['code'].'"';
}
if ($format == 3) {
print '<option value="'.$id.'"';
}
// Si selected est text, on compare avec code, sinon avec id
if (preg_match('/[a-z]/i', $selected) && $selected == $arraycategories['code']) {
print ' selected="selected"';
} elseif ($selected == $id) {
print ' selected="selected"';
} elseif ($arraycategories['use_default'] == "1" && !$selected && !$empty) {
print ' selected="selected"';
}
print '>';
if ($format == 0) {
$value = ($maxlength ? dol_trunc($arraycategories['label'], $maxlength) : $arraycategories['label']);
}
if ($format == 1) {
$value = $arraycategories['code'];
}
if ($format == 2) {
$value = ($maxlength ? dol_trunc($arraycategories['label'], $maxlength) : $arraycategories['label']);
}
if ($format == 3) {
$value = $arraycategories['code'];
}
print $value ? $value : '&nbsp;';
print '</option>';
}
}
print '</select>';
if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print '</select>';
if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print ajax_combobox('select'.$htmlname);
print ajax_combobox('select'.$htmlname);
} else {
$groupticket=GETPOST('groupticket', 'aZ09');
$groupticketchild=GETPOST('groupticket_child', 'aZ09');
$arraycodenotparent[] = "";
$stringtoprint = '<span class="supportemailfield bold">'.$langs->trans("GroupOfTicket").'</span> ';
$stringtoprint .= '<select name="groupticket" id ="groupticket" class="maxwidth500 minwidth400">';
$stringtoprint .= '<option value="">&nbsp;</option>';
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ";
$sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent)", "'NOTPARENT'", "'PARENT'")." as isparent";
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc";
$sql .= " WHERE ctc.public = 1";
$sql .= " AND ctc.active = 1";
$sql .= " AND ctc.fk_parent = 0";
$sql .= $this->db->order('ctc.pos', 'ASC');
$resql = $this->db->query($sql);
if ($resql) {
$num_rows = $this->db->num_rows($resql);
$i = 0;
while ($i < $num_rows) {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$grouprowid = $obj->rowid;
$groupvalue = $obj->code;
$grouplabel = $obj->label;
$isparent = $obj->isparent;
$iselected = $groupticket == $obj->code ?'selected':'';
$stringtoprint .= '<option '.$iselected.' class="groupticket'.dol_escape_htmltag($grouprowid).'" value="'.dol_escape_htmltag($groupvalue).'" data-html="'.dol_escape_htmltag($grouplabel).'">'.dol_escape_htmltag($grouplabel).'</option>';
if ($isparent == 'NOTPARENT') {
$arraycodenotparent[] = $groupvalue;
}
}
$i++;
}
} else {
dol_print_error($this->db);
}
if ($num_rows == 1) {
return '<input type="hidden" name="groupticket" id="groupticket" value="'.dol_escape_htmltag($groupvalue).'">';
}
$stringtoprint .= '</select>&nbsp';
$stringtoprint .= '<select name="groupticket_child" id ="groupticket_child" class="maxwidth500 minwidth400">';
$stringtoprint .= '<option value="">&nbsp;</option>';
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctcjoin.code as codefather";
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc";
$sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctcjoin ON ctc.fk_parent = ctcjoin.rowid";
$sql .= " WHERE ctc.public = 1";
$sql .= " AND ctc.active = 1";
$sql .= " AND ctc.fk_parent <> 0";
$sql .= $this->db->order('ctc.pos', 'ASC');
$resql = $this->db->query($sql);
if ($resql) {
$num_rows = $this->db->num_rows($resql);
$i = 0;
while ($i < $num_rows) {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$grouprowid = $obj->rowid;
$groupvalue = $obj->code;
$grouplabel = $obj->label;
$fatherid = $obj->fk_parent;
$groupcodefather = $obj->codefather;
$iselected = $groupticketchild == $obj->code ?'selected':'';
$stringtoprint .= '<option '.$iselected.' class="groupticket_'.dol_escape_htmltag($fatherid).'_child" value="'.dol_escape_htmltag($groupvalue).'" data-html="'.dol_escape_htmltag($grouplabel).'">'.dol_escape_htmltag($grouplabel).'</option>';
$tabscript[] = 'if($("#groupticket")[0].value == "'.dol_escape_js($groupcodefather).'"){
$(".groupticket_'.dol_escape_htmltag($fatherid).'_child").show()
}else{
$(".groupticket_'.dol_escape_htmltag($fatherid).'_child").hide()
}';
}
$i++;
}
} else {
dol_print_error($this->db);
}
$stringtoprint .='</select>';
$stringtoprint .='<script>';
$stringtoprint .='var arraynotparents = '.json_encode($arraycodenotparent).';';
$stringtoprint .='if (arraynotparents.includes($("#groupticket")[0].value)){$("#groupticket_child").hide()}
else{';
foreach ($tabscript as $script) {
$stringtoprint .= $script;
};
$stringtoprint .='}
$("#groupticket").change(function() {
$("#groupticket_child")[0].value = ""
if (!arraynotparents.includes(this.value)) {
$("#groupticket_child").show()
} else {
$("#groupticket_child").hide()
}
';
foreach ($tabscript as $script) {
$stringtoprint .= $script;
};
$stringtoprint .='})';
$stringtoprint .='</script>';
return $stringtoprint;
}
}
/**

View File

@ -70,8 +70,6 @@ $socid = GETPOST('socid', 'int');
$projectid = GETPOST('projectid', 'int');
$cancel = GETPOST('cancel', 'alpha');
$lineid = GETPOST('lineid', 'int');
$lineid = GETPOST('lineid', 'int');
$origin = GETPOST('origin', 'alpha');
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility

View File

@ -1791,8 +1791,8 @@ if (!empty($conf->projet->enabled)) {
$now = dol_now();
$title = $langs->trans('SupplierInvoice')." - ".$langs->trans('Card');
$helpurl = "EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores";
llxHeader('', $title, $helpurl);
$help_url = 'EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores|DE:Modul_Lieferantenrechnungen';
llxHeader('', $title, $help_url);
// Mode creation
if ($action == 'create') {

View File

@ -121,7 +121,7 @@ $form = new Form($db);
$productstatic = new Product($db);
$companystatic = new Societe($db);
$title = $langs->trans("ProductsAndServices");
$title = $langs->trans('Supplier')." - ".$langs->trans('ProductsAndServices');
if ($fourn_id) {
$supplier = new Fournisseur($db);

View File

@ -216,21 +216,21 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (18
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (184,'PL','POL','Pologne',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (185,'PR','PRI','Puerto Rico',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (186,'QA','QAT','Qatar',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (188,'RO','ROU','Roumanie',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (188,'RO','ROU','Romania',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (189,'RW','RWA','Rwanda',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (190,'SH','SHN','Sainte-Hélène',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (191,'KN','KNA','Saint-Christophe-et-Niévès',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (192,'LC','LCA','Sainte-Lucie',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (193,'PM','SPM','Saint-Pierre-et-Miquelon',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (194,'VC','VCT','Saint-Vincent-et-les-Grenadines',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (190,'SH','SHN','Saint Helena',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (191,'KN','KNA','Saint Kitts and Nevis',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (192,'LC','LCA','Saint Lucia',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (193,'PM','SPM','Saint Pierre and Miquelon',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (194,'VC','VCT','Saint Vincent and the Grenadines',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (195,'WS','WSM','Samoa',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (196,'SM','SMR','Saint-Marin',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (197,'ST','STP','Sao Tomé-et-Principe',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (198,'RS','SRB','Serbie',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (196,'SM','SMR','San Marino ',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (197,'ST','STP','Saint Thomas and Prince',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (198,'RS','SRB','Serbia',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (199,'SC','SYC','Seychelles',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (200,'SL','SLE','Sierra Leone',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (201,'SK','SVK','Slovaquie',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (202,'SI','SVN','Slovénie',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (201,'SK','SVK','Slovakia',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (202,'SI','SVN','Slovenia',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (203,'SB','SLB','Iles Salomon',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (204,'SO','SOM','Somalie',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (205,'ZA','ZAF','South Africa',1,0);

View File

@ -94,7 +94,9 @@ $usercanread = $user->rights->produit->lire;
$usercancreate = $user->rights->produit->creer;
$usercandelete = $user->rights->produit->supprimer;
$upload_dir = $conf->productbatch->multidir_output[$conf->entity];
if (empty($upload_dir)) {
$upload_dir = $conf->productbatch->multidir_output[$conf->entity];
}
$permissiontoread = $usercanread;
$permissiontoadd = $usercancreate;