Merge branch '12.0' of https://github.com/Dolibarr/dolibarr into FIX_multiple_order_linked_to_facture
This commit is contained in:
commit
66f7085225
@ -542,7 +542,7 @@ $cfg['ThemePerServer'] = FALSE; // allow diferent theme for each co
|
||||
* %f will be replaced by a list of field names.
|
||||
* (%t and %f only applies to DefaultQueryTable)
|
||||
*/
|
||||
$cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1';
|
||||
$cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1 = 1';
|
||||
$cfg['DefaultQueryDatabase'] = '';
|
||||
|
||||
/**
|
||||
|
||||
@ -158,11 +158,11 @@ if ($action == 'export_csv')
|
||||
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
print length_accountg($line->numero_compte).$sep;
|
||||
print $object->get_compte_desc($line->numero_compte).$sep;
|
||||
print price($line->debit).$sep;
|
||||
print price($line->credit).$sep;
|
||||
print price($line->debit - $line->credit).$sep;
|
||||
print '"'.length_accountg($line->numero_compte).'"'.$sep;
|
||||
print '"'.$object->get_compte_desc($line->numero_compte).'"'.$sep;
|
||||
print '"'.price($line->debit).'"'.$sep;
|
||||
print '"'.price($line->credit).'"'.$sep;
|
||||
print '"'.price($line->debit - $line->credit).'"'.$sep;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
|
||||
@ -519,9 +519,8 @@ class AccountancyExport
|
||||
$Tab['contrepartie'] = str_repeat(' ', 8);
|
||||
|
||||
// elarifr: date format must be fixed format : 6 char ddmmyy = %d%m%yand not defined by user / dolibarr setting
|
||||
if (!empty($data->date_echeance))
|
||||
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y'); // elarifr: format must be ddmmyy
|
||||
if (!empty($data->date_lim_reglement))
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_lim_reglement, '%d%m%y'); // elarifr: format must be ddmmyy
|
||||
else
|
||||
$Tab['date_echeance'] = '000000';
|
||||
|
||||
@ -617,9 +616,8 @@ class AccountancyExport
|
||||
|
||||
$Tab['code_stat'] = str_repeat(' ', 4);
|
||||
|
||||
if (!empty($data->date_echeance))
|
||||
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%Y');
|
||||
if (!empty($data->date_lim_reglement))
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_lim_reglement, '%d%m%Y');
|
||||
else
|
||||
$Tab['date_echeance'] = dol_print_date($data->doc_date, '%d%m%Y');
|
||||
|
||||
|
||||
@ -781,7 +781,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
|
||||
$sql .= (int) GETPOST($keycode, 'int');
|
||||
}
|
||||
else {
|
||||
else {
|
||||
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
|
||||
}
|
||||
|
||||
|
||||
@ -257,7 +257,7 @@ if (empty($reshook))
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
$sql .= $tabfieldinsert[$id];
|
||||
$sql .= ",active)";
|
||||
$sql .= ",active,enabled)";
|
||||
$sql .= " VALUES(";
|
||||
|
||||
// List of values
|
||||
@ -289,7 +289,7 @@ if (empty($reshook))
|
||||
|
||||
$i++;
|
||||
}
|
||||
$sql .= ", 1)";
|
||||
$sql .= ", 1, 1)";
|
||||
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
||||
@ -197,7 +197,7 @@ if ($action == 'delete')
|
||||
$form = new Form($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
$wikihelp = 'EN:Setup Translation|FR:Paramétrage traduction|ES:Configuración';
|
||||
$wikihelp = 'EN:Setup_Translation|FR:Paramétrage_Traduction|ES:Configuración_Traducción';
|
||||
llxHeader('', $langs->trans("Setup"), $wikihelp);
|
||||
|
||||
$param = '&mode='.$mode;
|
||||
|
||||
@ -66,6 +66,8 @@ $modulesdir = dolGetModulesDirs('/mailings');
|
||||
$object = new Mailing($db);
|
||||
$result = $object->fetch($id);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('ciblescard', 'globalcard'));
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -471,6 +473,10 @@ if ($object->fetch($id) >= 0)
|
||||
}
|
||||
} // End foreach dir
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
@ -327,7 +327,7 @@ if (empty($reshook))
|
||||
$duration = GETPOST('duree_validite', 'int');
|
||||
|
||||
if (empty($datep)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePropal")), null, 'errors');
|
||||
$action = 'create';
|
||||
$error++;
|
||||
}
|
||||
@ -1622,7 +1622,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Date
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DatePropal').'</td><td>';
|
||||
print $form->selectDate('', '', '', '', '', "addprop", 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -2051,7 +2051,7 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Date');
|
||||
print $langs->trans('DatePropal');
|
||||
print '</td>';
|
||||
if ($action != 'editdate' && $object->statut == Propal::STATUS_DRAFT && $usercancreate)
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
||||
|
||||
@ -162,7 +162,7 @@ $arrayfields = array(
|
||||
'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
|
||||
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
|
||||
'p.date'=>array('label'=>"Date", 'checked'=>1),
|
||||
'p.date'=>array('label'=>"DatePropal", 'checked'=>1),
|
||||
'p.fin_validite'=>array('label'=>"DateEnd", 'checked'=>1),
|
||||
'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0),
|
||||
'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0),
|
||||
|
||||
@ -78,6 +78,7 @@ class CommandeStats extends Stats
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
$this->where .= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
$this->categ_link=MAIN_DB_PREFIX.'categorie_societe';
|
||||
}
|
||||
elseif ($mode == 'supplier')
|
||||
{
|
||||
@ -87,6 +88,7 @@ class CommandeStats extends Stats
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
$this->where .= " c.fk_statut > 2"; // Only approved & ordered
|
||||
$this->categ_link=MAIN_DB_PREFIX.'categorie_fournisseur';
|
||||
}
|
||||
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
|
||||
$this->where .= ' AND c.entity IN ('.getEntity('commande').')';
|
||||
@ -106,7 +108,7 @@ class CommandeStats extends Stats
|
||||
|
||||
if ($categid)
|
||||
{
|
||||
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cats ON cats.fk_soc = c.fk_soc';
|
||||
$this->join .= ' LEFT JOIN '.$this->categ_link.' as cats ON cats.fk_soc = c.fk_soc';
|
||||
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cat.rowid = cats.fk_categorie';
|
||||
$this->where .= ' AND cat.rowid = '.$categid;
|
||||
}
|
||||
|
||||
@ -250,6 +250,8 @@ if ($search_email) $sql .= natural_search('s.email', $search_email);
|
||||
if ($search_contract) $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
|
||||
if (!empty($search_ref_customer)) $sql .= natural_search(array('c.ref_customer'), $search_ref_customer);
|
||||
if (!empty($search_ref_supplier)) $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
|
||||
if ($search_zip) $sql .= natural_search(array('s.zip'), $search_zip);
|
||||
if ($search_town) $sql .= natural_search(array('s.town'), $search_town);
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
|
||||
|
||||
@ -603,6 +603,8 @@ class ExtraFields
|
||||
*/
|
||||
public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if ($elementtype == 'thirdparty') $elementtype = 'societe';
|
||||
if ($elementtype == 'contact') $elementtype = 'socpeople';
|
||||
|
||||
@ -643,6 +645,18 @@ class ExtraFields
|
||||
}
|
||||
$field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required ? 'NOT NULL' : 'NULL'), 'default'=>$default);
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$hookmanager->initHooks(array('extrafieldsdao'));
|
||||
$parameters = array('field_desc'=>&$field_desc, 'table'=>$table, 'attr_name'=>$attrname, 'label'=>$label, 'type'=>$type, 'length'=>$length, 'unique'=>$unique, 'required'=>$required, 'pos'=>$pos, 'param'=>$param, 'alwayseditable'=>$alwayseditable, 'perms'=>$perms, 'list'=>$list, 'help'=>$help, 'default'=>$default, 'computed'=>$computed, 'entity'=>$entity, 'langfile'=>$langfile, 'enabled'=>$enabled, 'totalizable'=>$totalizable, 'printable'=>$printable);
|
||||
$reshook = $hookmanager->executeHooks('updateExtrafields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if ($reshook < 0) {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($type != 'separate') // No table update when separate type
|
||||
{
|
||||
$result = $this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
|
||||
|
||||
@ -8306,7 +8306,7 @@ function getDictvalue($tablename, $field, $id, $checkentity = false, $rowidfield
|
||||
if (!isset($dictvalues[$tablename]))
|
||||
{
|
||||
$dictvalues[$tablename] = array();
|
||||
$sql = 'SELECT * FROM '.$tablename.' WHERE 1'; // Here select * is allowed as it is generic code and we don't have list of fields
|
||||
$sql = 'SELECT * FROM '.$tablename.' WHERE 1 = 1'; // Here select * is allowed as it is generic code and we don't have list of fields
|
||||
if ($checkentity) $sql .= ' AND entity IN (0,'.getEntity($tablename).')';
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -623,8 +623,8 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Add a background image on document
|
||||
if (!empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation being crazy and some content disappeared behind the image
|
||||
// Add a background image on document only if good setup of const
|
||||
if (!empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF) && ($conf->global->MAIN_USE_BACKGROUND_ON_PDF != '-1')) // Warning, this option make TCPDF generation being crazy and some content disappeared behind the image
|
||||
{
|
||||
$pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image
|
||||
$pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height);
|
||||
|
||||
@ -1560,7 +1560,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
|
||||
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
||||
@ -120,7 +120,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
|
||||
}
|
||||
else
|
||||
{
|
||||
$colspan = 13;
|
||||
$colspan = 14;
|
||||
if (!empty($conf->multicompany->enabled)) $colspan++;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -126,6 +126,52 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$newparent = $object->_load_ldap_dn($info, 1);
|
||||
|
||||
$result = $ldap->update($dn, $info, $user, $olddn, $newrdn, $newparent);
|
||||
|
||||
if ($result > 0 && !empty($object->context['newgroupid'])) { // We are in context of adding a new group to user
|
||||
$usergroup = new Usergroup($this->db);
|
||||
|
||||
$usergroup->fetch($object->context['newgroupid']);
|
||||
|
||||
$oldinfo = $usergroup->_load_ldap_info();
|
||||
$olddn = $usergroup->_load_ldap_dn($oldinfo);
|
||||
|
||||
// Verify if entry exist
|
||||
$container = $usergroup->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
$info = $usergroup->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call)
|
||||
$dn = $usergroup->_load_ldap_dn($info);
|
||||
|
||||
$result = $ldap->update($dn, $info, $user, $olddn);
|
||||
}
|
||||
|
||||
if ($result > 0 && !empty($object->context['oldgroupid'])) { // We are in context of removing a group from user
|
||||
$usergroup = new Usergroup($this->db);
|
||||
|
||||
$usergroup->fetch($object->context['oldgroupid']);
|
||||
|
||||
$oldinfo = $usergroup->_load_ldap_info();
|
||||
$olddn = $usergroup->_load_ldap_dn($oldinfo);
|
||||
|
||||
// Verify if entry exist
|
||||
$container = $usergroup->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
$info = $usergroup->_load_ldap_info(); // Contains all members, except the old one (remove already done before trigger call)
|
||||
$dn = $usergroup->_load_ldap_dn($info);
|
||||
|
||||
$result = $ldap->update($dn, $info, $user, $olddn);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
@ -282,8 +328,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
// Get a gid number for objectclass PosixGroup
|
||||
if (in_array('posixGroup', $info['objectclass'])) {
|
||||
// Get a gid number for objectclass PosixGroup if none was provided
|
||||
if (empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID]) && in_array('posixGroup', $info['objectclass'])) {
|
||||
$info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_GROUPS');
|
||||
}
|
||||
|
||||
|
||||
@ -1296,6 +1296,8 @@ if (empty($reshook))
|
||||
$tva_tx = get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $product_fourn_price_id);
|
||||
}
|
||||
|
||||
$object->special_code = $lines[$i]->special_code;
|
||||
|
||||
$result = $object->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
|
||||
@ -48,7 +48,7 @@ $hookmanager->initHooks(array('stockreplenishlist'));
|
||||
|
||||
//checks if a product has been ordered
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$sref = GETPOST('sref', 'alpha');
|
||||
$snom = GETPOST('snom', 'alpha');
|
||||
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
@ -213,7 +213,9 @@ if ($action == 'order' && isset($_POST['valid']))
|
||||
if ($resql && $db->num_rows($resql) > 0) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$order->fetch($obj->rowid);
|
||||
$order->fetch_thirdparty();
|
||||
foreach ($supplier['lines'] as $line) {
|
||||
if(empty($line->remise_percent)) $line->remise_percent = $order->thirdparty->remise_supplier_percent;
|
||||
$result = $order->addline(
|
||||
$line->desc,
|
||||
$line->subprice,
|
||||
@ -250,6 +252,7 @@ if ($action == 'order' && isset($_POST['valid']))
|
||||
//trick to know which orders have been generated this way
|
||||
$order->source = 42;
|
||||
foreach ($supplier['lines'] as $line) {
|
||||
if(empty($line->remise_percent)) $line->remise_percent = $order->thirdparty->remise_supplier_percent;
|
||||
$order->lines[] = $line;
|
||||
}
|
||||
$order->cond_reglement_id = $order->thirdparty->cond_reglement_supplier_id;
|
||||
@ -306,7 +309,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entre
|
||||
}
|
||||
|
||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price,';
|
||||
$sql .= ' p.price_ttc, p.price_base_type,p.fk_product_type,';
|
||||
$sql .= ' p.price_ttc, p.price_base_type, p.fk_product_type,';
|
||||
$sql .= ' p.tms as datem, p.duration, p.tobuy,';
|
||||
$sql .= ' p.desiredstock, p.seuil_stock_alerte,';
|
||||
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
|
||||
@ -324,11 +327,8 @@ $sql .= $hookmanager->resPrint;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')';
|
||||
if ($fk_supplier > 0) {
|
||||
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')';
|
||||
}
|
||||
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.$fk_entrepot.')';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.((int) $fk_entrepot).')';
|
||||
}
|
||||
|
||||
// Add fields from hooks
|
||||
@ -350,6 +350,9 @@ if ($sref) $sql .= natural_search('p.ref', $sref);
|
||||
if ($snom) $sql .= natural_search('p.label', $snom);
|
||||
$sql .= ' AND p.tobuy = 1';
|
||||
if (!empty($canvas)) $sql .= ' AND p.canvas = "'.$db->escape($canvas).'"';
|
||||
if ($fk_supplier > 0) {
|
||||
$sql .= ' AND EXISTS (SELECT pfp.rowid FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = '.((int) $fk_supplier).' AND pfp.entity IN ('.getEntity('product_fournisseur_price').'))';
|
||||
}
|
||||
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price';
|
||||
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
|
||||
$sql .= ', p.duration, p.tobuy';
|
||||
@ -763,7 +766,9 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
print '<td class="right">'.$alertstock.'</td>';
|
||||
|
||||
// Current stock (all warehouses)
|
||||
print '<td class="right">'.$warning.$stock.'</td>';
|
||||
print '<td class="right">'.$warning.$stock;
|
||||
print '<!-- stock returned by main sql is '.$objp->stock_physique.' -->';
|
||||
print '</td>';
|
||||
|
||||
// Already ordered
|
||||
print '<td class="right"><a href="replenishorders.php?search_product='.$prod->id.'">'.$ordered.'</a> '.$picto.'</td>';
|
||||
|
||||
@ -227,7 +227,7 @@ if ($type_element == 'propal')
|
||||
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
|
||||
$where .= " AND d.fk_propal = c.rowid";
|
||||
$where .= " AND c.entity = ".$conf->entity;
|
||||
$datePrint = 'c.datep';
|
||||
$dateprint = 'c.datep';
|
||||
$doc_number = 'c.ref';
|
||||
$thirdTypeSelect = 'customer';
|
||||
}
|
||||
@ -318,7 +318,7 @@ if (!empty($sql_select))
|
||||
if ($sref) $sql .= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'";
|
||||
if ($sprod_fulldescr)
|
||||
{
|
||||
$sql .= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'";
|
||||
$sql .= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%' OR d.description LIKE '%".$db->escape(dol_htmlentities($sprod_fulldescr))."%'";
|
||||
if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'";
|
||||
if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'";
|
||||
$sql .= ")";
|
||||
|
||||
@ -73,7 +73,7 @@ class Users extends DolibarrApi
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->user->user->lire) {
|
||||
if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) {
|
||||
throw new RestException(401, "You are not allowed to read list of users");
|
||||
}
|
||||
|
||||
@ -154,9 +154,9 @@ class Users extends DolibarrApi
|
||||
*/
|
||||
public function get($id, $includepermissions = 0)
|
||||
{
|
||||
//if (!DolibarrApiAccess::$user->rights->user->user->lire) {
|
||||
//throw new RestException(401);
|
||||
//}
|
||||
if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->useraccount->fetch($id);
|
||||
if (!$result)
|
||||
@ -188,7 +188,11 @@ class Users extends DolibarrApi
|
||||
*/
|
||||
public function getInfo()
|
||||
{
|
||||
$apiUser = DolibarrApiAccess::$user;
|
||||
if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) {
|
||||
throw new RestException(401, 'Not allowed');
|
||||
}
|
||||
|
||||
$apiUser = DolibarrApiAccess::$user;
|
||||
|
||||
$result = $this->useraccount->fetch($apiUser->id);
|
||||
if (!$result) {
|
||||
@ -219,9 +223,9 @@ class Users extends DolibarrApi
|
||||
public function post($request_data = null)
|
||||
{
|
||||
// check user authorization
|
||||
//if(! DolibarrApiAccess::$user->rights->user->creer) {
|
||||
// throw new RestException(401, "User creation not allowed");
|
||||
//}
|
||||
if (empty(DolibarrApiAccess::$user->rights->user->creer) && empty(DolibarrApiAccess::$user->admin)) {
|
||||
throw new RestException(401, "User creation not allowed");
|
||||
}
|
||||
// check mandatory fields
|
||||
/*if (!isset($request_data["login"]))
|
||||
throw new RestException(400, "login field missing");
|
||||
@ -253,9 +257,9 @@ class Users extends DolibarrApi
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
//if (!DolibarrApiAccess::$user->rights->user->user->creer) {
|
||||
//throw new RestException(401);
|
||||
//}
|
||||
if (empty(DolibarrApiAccess::$user->rights->user->user->creer) && empty(DolibarrApiAccess::$user->admin)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->useraccount->fetch($id);
|
||||
if (!$result)
|
||||
@ -311,7 +315,7 @@ class Users extends DolibarrApi
|
||||
{
|
||||
$obj_ret = array();
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->user->user->lire) {
|
||||
if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) {
|
||||
throw new RestException(403);
|
||||
}
|
||||
|
||||
@ -346,9 +350,9 @@ class Users extends DolibarrApi
|
||||
|
||||
global $conf;
|
||||
|
||||
//if (!DolibarrApiAccess::$user->rights->user->user->supprimer) {
|
||||
//throw new RestException(401);
|
||||
//}
|
||||
if (empty(DolibarrApiAccess::$user->rights->user->user->creer) && empty(DolibarrApiAccess::$user->admin)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->useraccount->fetch($id);
|
||||
if (!$result)
|
||||
{
|
||||
@ -401,9 +405,10 @@ class Users extends DolibarrApi
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->user->group_advance->read) {
|
||||
throw new RestException(401, "You are not allowed to read list of groups");
|
||||
}
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) ||
|
||||
!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->group_advance->read) && empty(DolibarrApiAccess::$user->admin)) {
|
||||
throw new RestException(401, "You are not allowed to read groups");
|
||||
}
|
||||
|
||||
// case of external user, $societe param is ignored and replaced by user's socid
|
||||
//$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $societe;
|
||||
@ -475,7 +480,8 @@ class Users extends DolibarrApi
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->user->group_advance->read) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) ||
|
||||
!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->group_advance->read) && empty(DolibarrApiAccess::$user->admin)) {
|
||||
throw new RestException(401, "You are not allowed to read groups");
|
||||
}
|
||||
|
||||
@ -498,9 +504,9 @@ class Users extends DolibarrApi
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//if (!DolibarrApiAccess::$user->rights->user->user->supprimer) {
|
||||
//throw new RestException(401);
|
||||
//}
|
||||
if (empty(DolibarrApiAccess::$user->rights->user->user->supprimer) && empty(DolibarrApiAccess::$user->admin)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->useraccount->fetch($id);
|
||||
if (!$result)
|
||||
{
|
||||
|
||||
@ -3317,7 +3317,7 @@ class User extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql .= " WHERE 1";
|
||||
$sql .= " WHERE 1 = 1";
|
||||
}
|
||||
|
||||
// Manage filter
|
||||
|
||||
@ -675,7 +675,7 @@ class UserGroup extends CommonObject
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
if (empty($this->nom) && !empty($this->name)) {
|
||||
if ((empty($this->nom) || $this->nom != $this->name) && !empty($this->name)) {
|
||||
$this->nom = $this->name;
|
||||
}
|
||||
|
||||
@ -848,7 +848,7 @@ class UserGroup extends CommonObject
|
||||
}
|
||||
$info[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] = (!empty($valueofldapfield) ? $valueofldapfield : '');
|
||||
}
|
||||
if (!empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID])) {
|
||||
if (!empty($conf->global->LDAP_GROUP_FIELD_GROUPID)) {
|
||||
$info[$conf->global->LDAP_GROUP_FIELD_GROUPID] = $this->id;
|
||||
}
|
||||
return $info;
|
||||
|
||||
@ -69,8 +69,8 @@ if ($action == 'dolibarr2ldap')
|
||||
{
|
||||
$info = $object->_load_ldap_info();
|
||||
|
||||
// Get a gid number for objectclass PosixGroup
|
||||
if (in_array('posixGroup', $info['objectclass'])) {
|
||||
// Get a gid number for objectclass PosixGroup if none was provided
|
||||
if (empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID]) && in_array('posixGroup', $info['objectclass'])) {
|
||||
$info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_GROUPS');
|
||||
}
|
||||
|
||||
|
||||
@ -154,7 +154,7 @@ if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction = ''; }
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user