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

This commit is contained in:
Laurent Destailleur 2023-01-03 15:31:00 +01:00
commit ba6374e6be
14 changed files with 56 additions and 42 deletions

View File

@ -472,7 +472,7 @@ class AdherentType extends CommonObject
} }
/** /**
* Function that retrieves the status of the member * Function that retrieves the properties of a membership type
* *
* @param int $rowid Id of member type to load * @param int $rowid Id of member type to load
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK

View File

@ -683,14 +683,14 @@ if ($action == 'validate' && $permissiontoadd) {
$idwarehouse = 0; $idwarehouse = 0;
} }
if ($objecttmp->valid($user, $idwarehouse)) { if ($objecttmp->valid($user, $idwarehouse)) {
setEventMessage($langs->trans('hasBeenValidated', $objecttmp->ref), 'mesgs'); setEventMessages($langs->trans('hasBeenValidated', $objecttmp->ref), null, 'mesgs');
} else { } else {
setEventMessage($objecttmp->error, $objecttmp->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++; $error++;
} }
} else { } else {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans('ErrorIsNotADraft', $objecttmp->ref), 'errors'); setEventMessages($langs->trans('ErrorIsNotADraft', $objecttmp->ref), null, 'errors');
$error++; $error++;
} }
} else { } else {
@ -714,14 +714,14 @@ if ($action == 'shipped' && $permissiontoadd) {
if ($objecttmp->fetch($checked)) { if ($objecttmp->fetch($checked)) {
if ($objecttmp->statut == 1 || $objecttmp->statut == 2) { if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
if ($objecttmp->cloture($user)) { if ($objecttmp->cloture($user)) {
setEventMessage($langs->trans('PassedInClosedStatus', $objecttmp->ref), 'mesgs'); setEventMessages($langs->trans('PassedInClosedStatus', $objecttmp->ref), null, 'mesgs');
} else { } else {
setEventMessage($langs->trans('CantBeClosed'), 'errors'); setEventMessages($langs->trans('CantBeClosed'), null, 'errors');
$error++; $error++;
} }
} else { } else {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans('ErrorIsNotADraft', $objecttmp->ref), 'errors'); setEventMessages($langs->trans('ErrorIsNotADraft', $objecttmp->ref), null, 'errors');
$error++; $error++;
} }
} else { } else {

View File

@ -1956,14 +1956,14 @@ class Facture extends CommonInvoice
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid';
if ($rowid) { if ($rowid) {
$sql .= " WHERE f.rowid=".((int) $rowid); $sql .= " WHERE f.rowid = ".((int) $rowid);
} else { } else {
$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; // Don't use entity if you use rowid $sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; // Don't use entity if you use rowid
if ($ref) { if ($ref) {
$sql .= " AND f.ref='".$this->db->escape($ref)."'"; $sql .= " AND f.ref = '".$this->db->escape($ref)."'";
} }
if ($ref_ext) { if ($ref_ext) {
$sql .= " AND f.ref_ext='".$this->db->escape($ref_ext)."'"; $sql .= " AND f.ref_ext = '".$this->db->escape($ref_ext)."'";
} }
} }

View File

@ -52,7 +52,7 @@ $confirm = GETPOST('confirm', 'alpha');
llxHeader('', $langs->trans("Payment")); llxHeader('', $langs->trans("Payment"));
$object = new PaymentExpenseReport($db); $object = new PaymentExpenseReport($db);
$object->fetch($id, $ref); $object->fetch($id);
$object->info($object->id); $object->info($object->id);
$head = payment_expensereport_prepare_head($object); $head = payment_expensereport_prepare_head($object);

View File

@ -856,11 +856,14 @@ class FactureFournisseur extends CommonInvoice
* *
* @param int $id Id supplier invoice * @param int $id Id supplier invoice
* @param string $ref Ref supplier invoice * @param string $ref Ref supplier invoice
* @param string $ref_ext External reference of invoice
* @return int <0 if KO, >0 if OK, 0 if not found * @return int <0 if KO, >0 if OK, 0 if not found
*/ */
public function fetch($id = '', $ref = '') public function fetch($id = '', $ref = '', $ref_ext = '')
{ {
global $langs; if (empty($id) && empty($ref) && empty($ref_ext)) {
return -1;
}
$sql = "SELECT"; $sql = "SELECT";
$sql .= " t.rowid,"; $sql .= " t.rowid,";
@ -911,10 +914,15 @@ class FactureFournisseur extends CommonInvoice
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid';
if ($id) { if ($id) {
$sql .= " WHERE t.rowid=".((int) $id); $sql .= " WHERE t.rowid = ".((int) $id);
} } else {
$sql .= ' WHERE t.entity IN ('.getEntity('supplier_invoice').')'; // Don't use entity if you use rowid
if ($ref) { if ($ref) {
$sql .= " WHERE t.ref='".$this->db->escape($ref)."' AND t.entity IN (".getEntity('supplier_invoice').")"; $sql .= " AND t.ref = '".$this->db->escape($ref)."'";
}
if ($ref_ext) {
$sql .= " AND t.ref_ext = '".$this->db->escape($ref_ext)."'";
}
} }
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);

View File

@ -1580,7 +1580,7 @@ class Holiday extends CommonObject
// We add a log for each user // We add a log for each user
$this->addLogCP($user->id, $userCounter['rowid'], $langs->trans('HolidaysMonthlyUpdate'), $newSolde, $userCounter['type']); $this->addLogCP($user->id, $userCounter['rowid'], $langs->trans('HolidaysMonthlyUpdate'), $newSolde, $userCounter['type']);
$result = $this->updateSoldeCP($userCounter['rowid'], $newSolde, $userCounter['type'], $langs->trans('HolidaysMonthlyUpdate')); $result = $this->updateSoldeCP($userCounter['rowid'], $newSolde, $userCounter['type']);
if ($result < 0) { if ($result < 0) {
$error++; $error++;

View File

@ -207,6 +207,8 @@ ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_tx double(24,8) N
-- VMYSQL4.3 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN `rank` rankorder integer; -- VMYSQL4.3 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN `rank` rankorder integer;
-- VPGSQL8.2 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer; -- VPGSQL8.2 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer;
-- VMYSQL4.3 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN `rank` rankorder integer;
-- VPGSQL8.2 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN rank rankorder integer;
-- Rename const to hide public and private notes (fix allow notes const was used to hide) -- Rename const to hide public and private notes (fix allow notes const was used to hide)

View File

@ -335,7 +335,7 @@ class Contacts extends DolibarrApi
$this->contact->setNoEmail($this->contact->no_email); $this->contact->setNoEmail($this->contact->no_email);
} }
if ($this->contact->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) { if ($this->contact->update($id, DolibarrApiAccess::$user, 1, 'update')) {
return $this->get($id); return $this->get($id);
} }

View File

@ -33,11 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->loadLangs(array("main"), "categories", "takepos", "printing"); $langs->loadLangs(array("main", "categories", "takepos", "printing"));
if (!$user->rights->categorie->lire) {
accessforbidden();
}
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT); $type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT);
@ -51,9 +47,15 @@ if (is_numeric($type)) {
$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
} }
if (!$user->rights->categorie->lire) {
accessforbidden();
}
/* /*
* Actions * Actions
*/ */
if ($action == "SavePrinter1") { if ($action == "SavePrinter1") {
$printedcategories = ";"; $printedcategories = ";";
if (is_array($printer1)) { if (is_array($printer1)) {

View File

@ -81,7 +81,7 @@ $object->fetch($facid);
// Call to external receipt modules if exist // Call to external receipt modules if exist
$parameters = array(); $parameters = array();
$hookmanager->initHooks(array('takeposfrontend'), $facid); $hookmanager->initHooks(array('takeposfrontend'));
$reshook = $hookmanager->executeHooks('TakeposReceipt', $parameters, $object); $reshook = $hookmanager->executeHooks('TakeposReceipt', $parameters, $object);
if (!empty($hookmanager->resPrint)) { if (!empty($hookmanager->resPrint)) {
print $hookmanager->resPrint; print $hookmanager->resPrint;

View File

@ -305,7 +305,7 @@ if ($action == 'create') {
// Show object lines // Show object lines
$result = $object->getLinesArray(); $result = $object->getLinesArray();
print load_fiche_titre($langs->trans("PossibleValues") . (!empty($object->lines) ? ' (' . count($object->lines) . ')' : '')); print load_fiche_titre($langs->trans("PossibleValues") . (!empty($object->lines) ? '<span class="opacitymedium colorblack paddingleft">(' . count($object->lines) . ')</span>' : ''));
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST"> print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
<input type="hidden" name="token" value="' . newToken() . '"> <input type="hidden" name="token" value="' . newToken() . '">

View File

@ -83,9 +83,11 @@ class ProductCombination2ValuePair
/** /**
* Creates a product combination 2 value pair * Creates a product combination 2 value pair
*
* @param User $user User that create
* @return int <0 KO, >0 OK * @return int <0 KO, >0 OK
*/ */
public function create() public function create($user)
{ {
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_attribute_combination2val $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_attribute_combination2val
(fk_prod_combination, fk_prod_attr, fk_prod_attr_val) (fk_prod_combination, fk_prod_attr, fk_prod_attr_val)

View File

@ -851,15 +851,15 @@ if (!empty($id) || !empty($ref)) {
$aaa = ''; $aaa = '';
if (count($productCombinations)) { if (count($productCombinations)) {
$aaa = '<label for="massaction">'.$langs->trans('BulkActions').'</label>'; $aaa = '<select id="bulk_action" name="massaction" class="flat">';
$aaa .= '<select id="bulk_action" name="massaction" class="flat">';
$aaa .= ' <option value="nothing">&nbsp;</option>'; $aaa .= ' <option value="nothing">&nbsp;</option>';
$aaa .= ' <option value="not_buy">'.$langs->trans('ProductStatusNotOnBuy').'</option>'; $aaa .= ' <option value="not_buy" data-html="'.dol_escape_htmltag(img_picto($langs->trans("SetToStatus"), 'stop-circle', 'class="pictofixedwidth"').$langs->trans('SetToStatus', $langs->transnoentitiesnoconv('ProductStatusNotOnBuy'))).'">'.$langs->trans('ProductStatusNotOnBuy').'</option>';
$aaa .= ' <option value="not_sell">'.$langs->trans('ProductStatusNotOnSell').'</option>'; $aaa .= ' <option value="not_sell" data-html="'.dol_escape_htmltag(img_picto($langs->trans("SetToStatus"), 'stop-circle', 'class="pictofixedwidth"').$langs->trans('SetToStatus', $langs->transnoentitiesnoconv('ProductStatusNotOnSell'))).'">'.$langs->trans('ProductStatusNotOnSell').'</option>';
$aaa .= ' <option value="on_buy">'.$langs->trans('ProductStatusOnBuy').'</option>'; $aaa .= ' <option value="on_buy" data-html="'.dol_escape_htmltag(img_picto($langs->trans("SetToStatus"), 'stop-circle', 'class="pictofixedwidth"').$langs->trans('SetToStatus', $langs->transnoentitiesnoconv('ProductStatusOnBuy'))).'">'.$langs->trans('ProductStatusOnBuy').'</option>';
$aaa .= ' <option value="on_sell">'.$langs->trans('ProductStatusOnSell').'</option>'; $aaa .= ' <option value="on_sell" data-html="'.dol_escape_htmltag(img_picto($langs->trans("SetToStatus"), 'stop-circle', 'class="pictofixedwidth"').$langs->trans('SetToStatus', $langs->transnoentitiesnoconv('ProductStatusOnSell'))).'">'.$langs->trans('ProductStatusOnSell').'</option>';
$aaa .= ' <option value="delete">'.$langs->trans('Delete').'</option>'; $aaa .= ' <option value="delete" data-html="'.dol_escape_htmltag(img_picto($langs->trans("Delete"), 'delete', 'class="pictofixedwidth"').$langs->trans('Delete')).'">'.$langs->trans('Delete').'</option>';
$aaa .= '</select>'; $aaa .= '</select>';
$aaa .= ajax_combobox("bulk_action");
$aaa .= '<input type="submit" value="'.dol_escape_htmltag($langs->trans("Apply")).'" class="button small">'; $aaa .= '<input type="submit" value="'.dol_escape_htmltag($langs->trans("Apply")).'" class="button small">';
} }
$massactionbutton = $aaa; $massactionbutton = $aaa;

View File

@ -139,7 +139,7 @@ if ($result >= 0) {
// Warning $ldapuser has a key in lowercase // Warning $ldapuser has a key in lowercase
foreach ($ldaprecords as $key => $ldapgroup) { foreach ($ldaprecords as $key => $ldapgroup) {
$membertype = new AdherentType($db); $membertype = new AdherentType($db);
$membertype->fetch('', $ldapgroup[$conf->global->LDAP_KEY_MEMBERS_TYPES]); $membertype->fetch($ldapgroup[$conf->global->LDAP_KEY_MEMBERS_TYPES]);
$membertype->label = $ldapgroup[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME]; $membertype->label = $ldapgroup[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME];
$membertype->description = $ldapgroup[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION]; $membertype->description = $ldapgroup[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION];
$membertype->entity = $conf->entity; $membertype->entity = $conf->entity;