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

This commit is contained in:
Laurent Destailleur 2021-10-26 13:09:15 +02:00
commit d82cbf6636
6 changed files with 23 additions and 19 deletions

View File

@ -790,10 +790,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
if (!empty($socid)) { if (!empty($socid)) {
$object = new Societe($db); $soc = new Societe($db);
if ($socid > 0) $object->fetch($socid); if ($socid > 0) $soc->fetch($socid);
if (!($object->id > 0)) { if (!($soc->id > 0)) {
$langs->load("errors"); $langs->load("errors");
print($langs->trans('ErrorRecordNotFound')); print($langs->trans('ErrorRecordNotFound'));
exit; exit;
@ -877,7 +877,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print "</td>\n"; print "</td>\n";
// Company // Company
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET('societe') ? GETPOST('societe', 'alphanohtml') : $object->company).'"></td></tr>'; print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET('societe') ? GETPOST('societe', 'alphanohtml') : $soc->name).'"></td></tr>';
// Civility // Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>'; print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
@ -901,32 +901,32 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// EMail // EMail
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>'; print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $object->email).'"></td></tr>'; print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $soc->email).'"></td></tr>';
// Address // Address
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $object->address).'</textarea>'; print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $soc->address).'</textarea>';
print '</td></tr>'; print '</td></tr>';
// Zip / Town // Zip / Town
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>'; print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $soc->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
print ' '; print ' ';
print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $soc->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print '</td></tr>'; print '</td></tr>';
// Country // Country
$object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id; $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>'; print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $object->country_id, 'country_id'); print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $soc->country_id, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>'; print '</td></tr>';
// State // State
if (empty($conf->global->MEMBER_DISABLE_STATE)) { if (empty($conf->global->MEMBER_DISABLE_STATE)) {
print '<tr><td>'.$langs->trans('State').'</td><td>'; print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($object->country_id) { if ($soc->country_id) {
print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $object->state_id, $object->country_code); print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $soc->state_id, $soc->country_code);
} else { } else {
print $countrynotdefined; print $countrynotdefined;
} }
@ -935,7 +935,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Pro phone // Pro phone
print '<tr><td>'.$langs->trans("PhonePro").'</td>'; print '<tr><td>'.$langs->trans("PhonePro").'</td>';
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $object->phone).'"></td></tr>'; print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $soc->phone).'"></td></tr>';
// Personal phone // Personal phone
print '<tr><td>'.$langs->trans("PhonePerso").'</td>'; print '<tr><td>'.$langs->trans("PhonePerso").'</td>';

View File

@ -5492,7 +5492,6 @@ abstract class CommonObject
} }
$sql .= ")"; $sql .= ")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) if (!$resql)
{ {
@ -5746,6 +5745,11 @@ abstract class CommonObject
$this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]); $this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]);
} }
break; break;
case 'boolean':
if (empty($this->array_options["options_".$key])) {
$this->array_options["options_".$key] = null;
}
break;
/* /*
case 'link': case 'link':
$param_list = array_keys($attributeParam['options']); $param_list = array_keys($attributeParam['options']);

View File

@ -133,7 +133,7 @@ class ActionsDatapolicy
header('Content-Disposition: attachment; filename=datapolicy_portabilite.csv'); header('Content-Disposition: attachment; filename=datapolicy_portabilite.csv');
header('Pragma: no-cache'); header('Pragma: no-cache');
$object->fetch(GETPOST('socid')); $object->fetch(GETPOST('socid'));
echo 'Name;Fistname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL; echo 'Name;Firstname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo $object->name.';'; echo $object->name.';';
echo ';'; echo ';';
echo ';'; echo ';';
@ -157,7 +157,7 @@ class ActionsDatapolicy
header('Pragma: no-cache'); header('Pragma: no-cache');
$soc = $object->fetch_thirdparty(); $soc = $object->fetch_thirdparty();
echo 'Name;Fistname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL; echo 'Name;Firstname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo $object->lastname.';'; echo $object->lastname.';';
echo $object->firstname.';'; echo $object->firstname.';';
echo $object->getCivilityLabel().';'; echo $object->getCivilityLabel().';';
@ -181,7 +181,7 @@ class ActionsDatapolicy
header('Content-Disposition: attachment; filename=datapolicy_portabilite.csv'); header('Content-Disposition: attachment; filename=datapolicy_portabilite.csv');
header('Pragma: no-cache'); header('Pragma: no-cache');
$soc = $object->fetch_thirdparty(); $soc = $object->fetch_thirdparty();
echo 'Name;Fistname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL; echo 'Name;Firstname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo $object->lastname.';'; echo $object->lastname.';';
echo $object->firstname.';'; echo $object->firstname.';';
echo $object->getCivilityLabel().';'; echo $object->getCivilityLabel().';';

View File

@ -590,7 +590,7 @@ if ($ok && GETPOST('restore_user_pictures', 'alpha'))
$filetotestsmall = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/thumbs/'.$name.'_small'.$ext; $filetotestsmall = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/thumbs/'.$name.'_small'.$ext;
$filetotestmini = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/thumbs/'.$name.'_mini'.$ext; $filetotestmini = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/thumbs/'.$name.'_mini'.$ext;
$exists = dol_is_file($filetotest); $exists = dol_is_file($filetotest);
print 'Check user '.$obj->rowid.' lastname='.$obj->lastname.' fistname='.$obj->firstname.' photo='.$obj->photo.' file '.$filetotest." exists=".$exists."<br>\n"; print 'Check user '.$obj->rowid.' lastname='.$obj->lastname.' firstname='.$obj->firstname.' photo='.$obj->photo.' file '.$filetotest." exists=".$exists."<br>\n";
if ($exists) if ($exists)
{ {
$filetarget = $dolibarr_main_data_root.'/users/'.$obj->rowid.'/'.$name.$ext; $filetarget = $dolibarr_main_data_root.'/users/'.$obj->rowid.'/'.$name.$ext;

View File

@ -405,7 +405,7 @@ class Products extends DolibarrApi
$childsArbo = $this->product->getChildsArbo($id, 1); $childsArbo = $this->product->getChildsArbo($id, 1);
$keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec']; $keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec', 'ref'];
$childs = []; $childs = [];
foreach ($childsArbo as $values) { foreach ($childsArbo as $values) {
$childs[] = array_combine($keys, $values); $childs[] = array_combine($keys, $values);

View File

@ -1657,7 +1657,7 @@ class Ticket extends CommonObject
$actioncomm->userassigned = array($user->id); $actioncomm->userassigned = array($user->id);
$actioncomm->userownerid = $user->id; $actioncomm->userownerid = $user->id;
$actioncomm->datep = $now; $actioncomm->datep = $now;
$actioncomm->percentage = 100; $actioncomm->percentage = -1; // percentage is not relevant for punctual events
$actioncomm->elementtype = 'ticket'; $actioncomm->elementtype = 'ticket';
$actioncomm->fk_element = $this->id; $actioncomm->fk_element = $this->id;