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

This commit is contained in:
Laurent Destailleur 2021-10-14 12:00:33 +02:00
commit bc230dbfc2
6 changed files with 43 additions and 8 deletions

View File

@ -1048,6 +1048,7 @@ if ($id)
elseif ($search_code != '' && $id == 28) $sql .= natural_search("h.code", $search_code);
elseif ($search_code != '' && $id == 32) $sql .= natural_search("a.code", $search_code);
elseif ($search_code != '' && $id == 3) $sql .= natural_search("r.code_region", $search_code);
elseif ($search_code != '' && $id == 10) $sql .= natural_search("t.code", $search_code);
elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code);
if ($sortfield)

View File

@ -443,11 +443,13 @@ if ($resql)
print '<td class="right">'.$invoice->getLibStatut(5, $alreadypayed).'</td>';
print "</tr>\n";
if ($objp->paye == 1) // If at least one invoice is paid, disable delete
{
// If at least one invoice is paid, disable delete. INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED Can be use for maintenance purpose. Never use this in production
if ($objp->paye == 1 && empty($conf->global->INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED)) {
$disable_delete = 1;
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid"));
}
$total = $total + $objp->amount;
$i++;
}

View File

@ -40,6 +40,30 @@
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
/**
* Return dolibarr global constant string value
* @param string $key key to return value, return '' if not set
* @return string
*/
function getDolGlobalString($key)
{
global $conf;
// return $conf->global->$key ?? '';
return (string) (empty($conf->global->$key) ? '' : $conf->global->$key);
}
/**
* Return dolibarr global constant int value
* @param string $key key to return value, return 0 if not set
* @return int
*/
function getDolGlobalInt($key)
{
global $conf;
// return $conf->global->$key ?? 0;
return (int) (empty($conf->global->$key) ? 0 : $conf->global->$key);
}
/**
* Return a DoliDB instance (database handler).
*

View File

@ -79,7 +79,11 @@ class InterfaceContactRoles extends DolibarrTriggers
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$contactdefault = new Contact($this->db);
$contactdefault->socid = $socid;
$TContact = $contactdefault->getContactRoles($object->element);
$TContact = array();
if (method_exists($contactdefault, 'getContactRoles')) { // For backward compatibility
$TContact = $contactdefault->getContactRoles($object->element);
}
if (is_array($TContact) && !empty($TContact)) {
$TContactAlreadyLinked = array();

View File

@ -668,6 +668,7 @@ if (empty($reshook))
elseif ($action == 'add' && $usercancreate)
{
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
$selectedLines = GETPOST('toselect', 'array');
$db->begin();
@ -980,6 +981,10 @@ if (empty($reshook))
$num = count($lines);
for ($i = 0; $i < $num; $i++) // TODO handle subprice < 0
{
if (!in_array($lines[$i]->id, $selectedLines)) {
continue; // Skip unselected lines
}
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
@ -2239,9 +2244,6 @@ if ($action == 'create')
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
print '</div>';
print "</form>\n";
// Show origin lines
if (is_object($objectsrc))
{
@ -2252,10 +2254,12 @@ if ($action == 'create')
print '<table class="noborder centpercent">';
$objectsrc->printOriginLinesList();
$objectsrc->printOriginLinesList('', $selectedLines);
print '</table>';
}
print "</form>\n";
}
else
{

View File

@ -487,7 +487,7 @@ if (empty($reshook))
if ($accountancy_code_buy_export <= 0) { $object->accountancy_code_buy_export = ''; } else { $object->accountancy_code_buy_export = $accountancy_code_buy_export; }
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
if ($ret < 0) $error++;
if (!$error && $object->check())