Merge remote-tracking branch 'upstream/develop' into 14a22

This commit is contained in:
Alexandre SPANGARO
2021-03-16 03:26:28 +01:00
674 changed files with 18715 additions and 9254 deletions

View File

@@ -488,7 +488,8 @@ class Form
$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
} elseif (preg_match('/^(select|autocomplete)/', $inputType)) {
$tmp = explode(':', $inputType);
$inputType = $tmp[0]; $loadmethod = $tmp[1];
$inputType = $tmp[0];
$loadmethod = $tmp[1];
if (!empty($tmp[2])) {
$savemethod = $tmp[2];
}
@@ -502,7 +503,8 @@ class Form
$cols = (empty($tmp[2]) ? '80' : $tmp[2]);
} elseif (preg_match('/^ckeditor/', $inputType)) {
$tmp = explode(':', $inputType);
$inputType = $tmp[0]; $toolbar = $tmp[1];
$inputType = $tmp[0];
$toolbar = $tmp[1];
if (!empty($tmp[2])) {
$width = $tmp[2];
}
@@ -594,15 +596,18 @@ class Form
$extrastyle = '';
if ($direction < 0) {
$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); $extrastyle = 'padding: 0px; padding-left: 3px !important;';
$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
$extrastyle = 'padding: 0px; padding-left: 3px !important;';
}
if ($direction > 0) {
$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); $extrastyle = 'padding: 0px; padding-right: 3px !important;';
$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
$extrastyle = 'padding: 0px; padding-right: 3px !important;';
}
$classfortooltip = 'classfortooltip';
$s = ''; $textfordialog = '';
$s = '';
$textfordialog = '';
if ($tooltiptrigger == '') {
$htmltext = str_replace('"', '&quot;', $htmltext);
@@ -2084,7 +2089,8 @@ class Form
if ($nbassignetouser) {
$out .= '<ul class="attendees">';
}
$i = 0; $ownerid = 0;
$i = 0;
$ownerid = 0;
foreach ($assignedtouser as $key => $value) {
if ($value['id'] == $ownerid) {
continue;
@@ -2094,7 +2100,8 @@ class Form
$userstatic->fetch($value['id']);
$out .= $userstatic->getNomUrl(-1);
if ($i == 0) {
$ownerid = $value['id']; $out .= ' ('.$langs->trans("Owner").')';
$ownerid = $value['id'];
$out .= ' ('.$langs->trans("Owner").')';
}
if ($nbassignetouser > 1 && $action != 'view') {
$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
@@ -3729,15 +3736,17 @@ class Form
* @param string $htmlname Nom de la zone select
* @param string $exclude To exclude a code value (Example: SRC_PROP)
* @param int $addempty Add an empty entry
* @param string $morecss Add more css to the HTML select component
* @param int $notooltip Do not show the tooltip for admin
* @return void
*/
public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0)
public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0, $morecss = '', $notooltip = 0)
{
global $langs, $user;
$this->loadCacheInputReason();
print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
if ($addempty) {
print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
}
@@ -3756,7 +3765,7 @@ class Form
print '</option>';
}
print '</select>';
if ($user->admin) {
if ($user->admin && empty($notooltip)) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print ajax_combobox('select_'.$htmlname);
@@ -5296,8 +5305,8 @@ class Form
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';
print '<select name="calculation_mode">';
print '<option value="1">'.$currency.' > '.$conf->currency.'</option>';
print '<option value="2">'.$conf->currency.' > '.$currency.'</option>';
print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>';
print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>';
print '</select> ';
print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
@@ -5811,7 +5820,8 @@ class Form
}
// Disabled if seller is not subject to VAT
$disabled = false; $title = '';
$disabled = false;
$title = '';
if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0") {
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
// of using supplier invoices (this is a very bad idea !)
@@ -5991,10 +6001,12 @@ class Form
$stepminutes = 1;
}
if ($empty == 1) {
$emptydate = 1; $emptyhours = 1;
$emptydate = 1;
$emptyhours = 1;
}
if ($empty == 2) {
$emptydate = 0; $emptyhours = 1;
$emptydate = 0;
$emptyhours = 1;
}
$orig_set_time = $set_time;
@@ -6149,9 +6161,8 @@ class Form
} else {
$retstring .= "Bad value of MAIN_POPUP_CALENDAR";
}
}
// Show date with combo selects
else {
} else {
// Show date with combo selects
// Day
$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
@@ -6448,7 +6459,8 @@ class Form
$retstring = '';
$hourSelected = 0; $minSelected = 0;
$hourSelected = 0;
$minSelected = 0;
// Hours
if ($iSecond != '') {
@@ -6914,7 +6926,8 @@ class Form
$style = empty($tmpvalue['css']) ? ' class="'.$tmpvalue['css'].'"' : '';
} else {
$value = $tmpvalue;
$disabled = ''; $style = '';
$disabled = '';
$style = '';
}
if (!empty($disablebademail)) {
if (($disablebademail == 1 && !preg_match('/&lt;.+@.+&gt;/', $value))
@@ -7634,7 +7647,7 @@ class Form
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'),
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'),
'contrat'=>array('enabled'=>$conf->contrat->enabled, 'perms'=>1, 'label'=>'LinkToContract',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
@@ -7700,7 +7713,12 @@ class Form
print '</td>';
print '<td class="center">'.$objp->ref.'</td>';
print '<td>'.$objp->ref_client.'</td>';
print '<td class="right">'.price($objp->total_ht).'</td>';
print '<td class="right">';
if ($possiblelink['label'] == 'LinkToContract') {
$form = new Form($this->db);
print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
}
print price($objp->total_ht).'</td>';
print '<td>'.$objp->name.'</td>';
print '</tr>';
$i++;
@@ -7714,15 +7732,12 @@ class Form
dol_print_error($this->db);
}
print '</div>';
if ($num > 0) {
}
//$linktoelem.=($linktoelem?' &nbsp; ':'');
if ($num > 0) {
$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
}
//else $linktoelem.=$langs->trans($possiblelink['label']);
else {
// } else $linktoelem.=$langs->trans($possiblelink['label']);
} else {
$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
}
}
@@ -7777,7 +7792,8 @@ class Form
{
global $langs;
$yes = "yes"; $no = "no";
$yes = "yes";
$no = "no";
if ($option) {
$yes = "1";
$no = "0";
@@ -7879,6 +7895,23 @@ class Form
$fieldref = 'ref';
}
// Preparing gender's display if there is one
$addgendertxt = '';
if ($object->gender) {
$addgendertxt = ' ';
switch ($object->gender) {
case 'man':
$addgendertxt .= '<i class="fas fa-mars"></i>';
break;
case 'woman':
$addgendertxt .= '<i class="fas fa-venus"></i>';
break;
case 'other':
$addgendertxt .= '<i class="fas fa-genderless"></i>';
break;
}
}
// Add where from hooks
if (is_object($hookmanager)) {
$parameters = array();
@@ -8005,12 +8038,12 @@ class Form
$ret .= $object->ref.'<br>';
$fullname = $object->getFullName($langs);
if ($object->morphy == 'mor' && $object->societe) {
$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).')' : '');
$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : '');
} else {
$ret .= dol_htmlentities($fullname).((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
}
} elseif (in_array($object->element, array('contact', 'user', 'usergroup'))) {
$ret .= dol_htmlentities($object->getFullName($langs));
$ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;
} elseif (in_array($object->element, array('action', 'agenda'))) {
$ret .= $object->ref.'<br>'.$object->label;
} elseif (in_array($object->element, array('adherent_type'))) {
@@ -8093,7 +8126,13 @@ class Form
$entity = (!empty($object->entity) ? $object->entity : $conf->entity);
$id = (!empty($object->id) ? $object->id : $object->rowid);
$ret = ''; $dir = ''; $file = ''; $originalfile = ''; $altfile = ''; $email = ''; $capture = '';
$ret = '';
$dir = '';
$file = '';
$originalfile = '';
$altfile = '';
$email = '';
$capture = '';
if ($modulepart == 'societe') {
$dir = $conf->societe->multidir_output[$entity];
if (!empty($object->logo)) {