Fix warnings

This commit is contained in:
Laurent Destailleur 2023-01-03 15:29:49 +01:00
parent f8abd0b7f6
commit 8d4e973e00
13 changed files with 54 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
* @return int <0 if KO, >0 if OK

View File

@ -679,14 +679,14 @@ if ($action == 'validate' && $permissiontoadd) {
$idwarehouse = 0;
}
if ($objecttmp->valid($user, $idwarehouse)) {
setEventMessage($langs->trans('hasBeenValidated', $objecttmp->ref), 'mesgs');
setEventMessages($langs->trans('hasBeenValidated', $objecttmp->ref), null, 'mesgs');
} else {
setEventMessage($objecttmp->error, $objecttmp->errors, 'errors');
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
}
} else {
$langs->load("errors");
setEventMessage($langs->trans('ErrorIsNotADraft', $objecttmp->ref), 'errors');
setEventMessages($langs->trans('ErrorIsNotADraft', $objecttmp->ref), null, 'errors');
$error++;
}
} else {
@ -710,14 +710,14 @@ if ($action == 'shipped' && $permissiontoadd) {
if ($objecttmp->fetch($checked)) {
if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
if ($objecttmp->cloture($user)) {
setEventMessage($langs->trans('PassedInClosedStatus', $objecttmp->ref), 'mesgs');
setEventMessages($langs->trans('PassedInClosedStatus', $objecttmp->ref), null, 'mesgs');
} else {
setEventMessage($langs->trans('CantBeClosed'), 'errors');
setEventMessages($langs->trans('CantBeClosed'), null, 'errors');
$error++;
}
} else {
$langs->load("errors");
setEventMessage($langs->trans('ErrorIsNotADraft', $objecttmp->ref), 'errors');
setEventMessages($langs->trans('ErrorIsNotADraft', $objecttmp->ref), null, 'errors');
$error++;
}
} 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';
if ($rowid) {
$sql .= " WHERE f.rowid=".((int) $rowid);
$sql .= " WHERE f.rowid = ".((int) $rowid);
} else {
$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; // Don't use entity if you use rowid
if ($ref) {
$sql .= " AND f.ref='".$this->db->escape($ref)."'";
$sql .= " AND f.ref = '".$this->db->escape($ref)."'";
}
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"));
$object = new PaymentExpenseReport($db);
$object->fetch($id, $ref);
$object->fetch($id);
$object->info($object->id);
$head = payment_expensereport_prepare_head($object);

View File

@ -852,15 +852,18 @@ class FactureFournisseur extends CommonInvoice
}
/**
* Load object in memory from database
* Load object in memory from database
*
* @param int $id Id supplier invoice
* @param string $ref Ref supplier invoice
* @return int <0 if KO, >0 if OK, 0 if not found
* @param int $id Id 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
*/
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 .= " 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_incoterms as i ON t.fk_incoterms = i.rowid';
if ($id) {
$sql .= " WHERE t.rowid=".((int) $id);
}
if ($ref) {
$sql .= " WHERE t.ref='".$this->db->escape($ref)."' AND t.entity IN (".getEntity('supplier_invoice').")";
$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) {
$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);

View File

@ -1580,7 +1580,7 @@ class Holiday extends CommonObject
// We add a log for each user
$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) {
$error++;

View File

@ -335,7 +335,7 @@ class Contacts extends DolibarrApi
$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);
}

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/admin.lib.php';
$langs->loadLangs(array("main"), "categories", "takepos", "printing");
if (!$user->rights->categorie->lire) {
accessforbidden();
}
$langs->loadLangs(array("main", "categories", "takepos", "printing"));
$id = GETPOST('id', 'int');
$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
}
if (!$user->rights->categorie->lire) {
accessforbidden();
}
/*
* Actions
*/
if ($action == "SavePrinter1") {
$printedcategories = ";";
if (is_array($printer1)) {

View File

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

View File

@ -305,7 +305,7 @@ if ($action == 'create') {
// Show object lines
$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">
<input type="hidden" name="token" value="' . newToken() . '">

View File

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

View File

@ -851,15 +851,15 @@ if (!empty($id) || !empty($ref)) {
$aaa = '';
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="not_buy">'.$langs->trans('ProductStatusNotOnBuy').'</option>';
$aaa .= ' <option value="not_sell">'.$langs->trans('ProductStatusNotOnSell').'</option>';
$aaa .= ' <option value="on_buy">'.$langs->trans('ProductStatusOnBuy').'</option>';
$aaa .= ' <option value="on_sell">'.$langs->trans('ProductStatusOnSell').'</option>';
$aaa .= ' <option value="delete">'.$langs->trans('Delete').'</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" 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" 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" 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" data-html="'.dol_escape_htmltag(img_picto($langs->trans("Delete"), 'delete', 'class="pictofixedwidth"').$langs->trans('Delete')).'">'.$langs->trans('Delete').'</option>';
$aaa .= '</select>';
$aaa .= ajax_combobox("bulk_action");
$aaa .= '<input type="submit" value="'.dol_escape_htmltag($langs->trans("Apply")).'" class="button small">';
}
$massactionbutton = $aaa;

View File

@ -21,9 +21,9 @@
*/
/**
* \file scripts/members/sync_members_types_ldap2dolibarr.php
* \file scripts/members/sync_members_types_ldap2dolibarr.php
* \ingroup ldap member
* \brief Script to update members types into Dolibarr from LDAP
* \brief Script to update members types into Dolibarr from LDAP
*/
if (!defined('NOSESSION')) {
@ -139,7 +139,7 @@ if ($result >= 0) {
// Warning $ldapuser has a key in lowercase
foreach ($ldaprecords as $key => $ldapgroup) {
$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->description = $ldapgroup[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION];
$membertype->entity = $conf->entity;