Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/core/modules/modUser.class.php
This commit is contained in:
commit
7931734ecb
@ -239,6 +239,7 @@ class AccountancyExport
|
||||
$filename = 'general_ledger-'.$this->getFormatCode($formatexportset);
|
||||
$type_export = 'general_ledger';
|
||||
|
||||
global $db; // The tpl file use $db
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
|
||||
@ -935,6 +936,7 @@ class AccountancyExport
|
||||
foreach ($objectLines as $line) {
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_lim_reglement = dol_print_date($line->date_lim_reglement, '%Y%m%d');
|
||||
|
||||
// TYPE
|
||||
$type_enregistrement = 'E'; // For write movement
|
||||
@ -950,7 +952,7 @@ class AccountancyExport
|
||||
// LIBE
|
||||
print $line->label_operation.$separator;
|
||||
// DATH
|
||||
print $line->date_lim_reglement.$separator;
|
||||
print $date_lim_reglement.$separator;
|
||||
// CNPI
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
@ -969,21 +971,19 @@ class AccountancyExport
|
||||
}
|
||||
print $nature_piece.$separator;
|
||||
// RACI
|
||||
/*
|
||||
if (! empty($line->subledger_account)) {
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
$racine_subledger_account = '40';
|
||||
} elseif ($line->doc_type == 'customer_invoice') {
|
||||
$racine_subledger_account = '41';
|
||||
} else {
|
||||
$nature_piece = '';
|
||||
}
|
||||
print $racine_subledger_account . $separator;
|
||||
} else {
|
||||
print $separator;
|
||||
}
|
||||
*/
|
||||
print $separator; // deprecated CPTG & CPTA use instead
|
||||
// if (! empty($line->subledger_account)) {
|
||||
// if ($line->doc_type == 'supplier_invoice') {
|
||||
// $racine_subledger_account = '40';
|
||||
// } elseif ($line->doc_type == 'customer_invoice') {
|
||||
// $racine_subledger_account = '41';
|
||||
// } else {
|
||||
// $racine_subledger_account = '';
|
||||
// }
|
||||
// } else {
|
||||
$racine_subledger_account = ''; // for records of type E leave this field blank
|
||||
// }
|
||||
|
||||
print $racine_subledger_account . $separator; // deprecated CPTG & CPTA use instead
|
||||
// MONT
|
||||
print price(abs($line->montant), 0, '', 1, 2).$separator;
|
||||
// CODC
|
||||
|
||||
@ -926,6 +926,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.debit,";
|
||||
$sql .= " t.credit,";
|
||||
$sql .= " t.lettering_code,";
|
||||
$sql .= " t.date_lettering,";
|
||||
$sql .= " t.montant,";
|
||||
$sql .= " t.sens,";
|
||||
$sql .= " t.fk_user_author,";
|
||||
@ -934,6 +935,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.journal_label,";
|
||||
$sql .= " t.piece_num,";
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.date_lim_reglement,";
|
||||
$sql .= " t.tms as date_modification,";
|
||||
$sql .= " t.date_export";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
@ -1006,12 +1008,14 @@ class BookKeeping extends CommonObject
|
||||
$line->montant = $obj->montant;
|
||||
$line->sens = $obj->sens;
|
||||
$line->lettering_code = $obj->lettering_code;
|
||||
$line->date_lettering = $obj->date_lettering;
|
||||
$line->fk_user_author = $obj->fk_user_author;
|
||||
$line->import_key = $obj->import_key;
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->journal_label = $obj->journal_label;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$line->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
|
||||
$line->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
|
||||
|
||||
@ -4580,15 +4580,40 @@ class Facture extends CommonInvoice
|
||||
// Paid invoices have status STATUS_CLOSED
|
||||
if ($this->statut != Facture::STATUS_VALIDATED) return false;
|
||||
|
||||
return $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
|
||||
$hasDelay = $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
|
||||
if($hasDelay && !empty($this->retained_warranty) && !empty($this->retained_warranty_date_limit))
|
||||
{
|
||||
$totalpaye = $this->getSommePaiement();
|
||||
$totalpaye = floatval($totalpaye);
|
||||
$RetainedWarrantyAmount = $this->getRetainedWarrantyAmount();
|
||||
if($totalpaye >= 0 && $RetainedWarrantyAmount>= 0)
|
||||
{
|
||||
if( ($totalpaye < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay) )
|
||||
{
|
||||
$hasDelay = 1;
|
||||
}
|
||||
elseif($totalpaye < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay) )
|
||||
{
|
||||
$hasDelay = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$hasDelay = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $hasDelay;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT)
|
||||
* @return number or -1 if not available
|
||||
*/
|
||||
public function getRetainedWarrantyAmount()
|
||||
public function getRetainedWarrantyAmount($rounding = -1)
|
||||
{
|
||||
global $conf;
|
||||
if (empty($this->retained_warranty)) {
|
||||
return -1;
|
||||
}
|
||||
@ -4632,6 +4657,11 @@ class Facture extends CommonInvoice
|
||||
$retainedWarrantyAmount = $this->total_ttc * $this->retained_warranty / 100;
|
||||
}
|
||||
|
||||
if ($rounding < 0){
|
||||
$rounding=min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
return round($retainedWarrantyAmount, 2);
|
||||
}
|
||||
|
||||
return $retainedWarrantyAmount;
|
||||
}
|
||||
|
||||
|
||||
@ -504,7 +504,7 @@ function measuring_units_string($scale = '', $measuring_style = '', $unit = 0, $
|
||||
* Return translation label of a unit key
|
||||
*
|
||||
* @param int $unit ID of unit (rowid in llx_c_units table)
|
||||
* @param string $measuring_style Style of unit: weight, volume,...
|
||||
* @param string $measuring_style Style of unit: 'weight', 'volume', ..., '' = 'net_measure' for option PRODUCT_ADD_NET_MEASURE
|
||||
* @param string $scale Scale of unit: '0', '-3', '6', ...
|
||||
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
|
||||
* @return string Unit string
|
||||
@ -520,7 +520,14 @@ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_sho
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
|
||||
$measuringUnits= new CUnits($db);
|
||||
|
||||
if ($scale !== '')
|
||||
if ($measuring_style == '' && $scale == '')
|
||||
{
|
||||
$arrayforfilter = array(
|
||||
't.rowid' => $unit,
|
||||
't.active' => 1
|
||||
);
|
||||
}
|
||||
elseif ($scale !== '')
|
||||
{
|
||||
$arrayforfilter = array(
|
||||
't.scale' => $scale,
|
||||
|
||||
@ -316,6 +316,9 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
{
|
||||
foreach ($feature2 as $subfeature)
|
||||
{
|
||||
if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->creer) continue; // User can edit its own card
|
||||
if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->password) continue; // User can edit its own password
|
||||
|
||||
if (empty($user->rights->$feature->$subfeature->creer)
|
||||
&& empty($user->rights->$feature->$subfeature->write)
|
||||
&& empty($user->rights->$feature->$subfeature->create)) {
|
||||
|
||||
@ -314,7 +314,8 @@ class modUser extends DolibarrModules
|
||||
'u.birth'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'
|
||||
);
|
||||
$this->import_examplevalues_array[$r] = array(
|
||||
'u.lastname'=>"Doe", 'u.firstname'=>'John', 'u.login'=>'jdoe', 'u.employee'=>'0 or 1',
|
||||
'u.lastname'=>"Doe", 'u.firstname'=>'John', 'u.login'=>'jdoe', 'u.employee'=>'0 or 1', 'u.job'=>'CTO', 'u.gender'=>'0 or 1',
|
||||
'u.pass_crypted'=>'Encrypted password',
|
||||
'u.fk_soc'=>'0 (internal user) or company name (external user)', 'u.datec'=>dol_print_date(dol_now(), '%Y-%m-%d'), 'u.address'=>"61 jump street",
|
||||
'u.zip'=>"123456", 'u.town'=>"Big town", 'u.fk_country'=>'US, FR, DE...', 'u.office_phone'=>"0101010101", 'u.office_fax'=>"0101010102",
|
||||
'u.email'=>"test@mycompany.com", 'u.salary'=>"10000", 'u.note'=>"This is an example of note for record", 'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00",
|
||||
|
||||
@ -47,8 +47,8 @@ $langs->loadLangs(array("mymodule@mymodule"));
|
||||
$action=GETPOST('action', 'alpha');
|
||||
|
||||
|
||||
// Securite acces client
|
||||
if (! $user->rights->mymodule->read) accessforbidden();
|
||||
// Security check
|
||||
//if (! $user->rights->mymodule->myobject->read) accessforbidden();
|
||||
$socid=GETPOST('socid', 'int');
|
||||
if (isset($user->socid) && $user->socid > 0)
|
||||
{
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
|
||||
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2019-2020 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1513,7 +1513,7 @@ else
|
||||
// Net Measure
|
||||
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td colspan="3">';
|
||||
print '<input name="net_measure" size="5" value="'.$object->net_measure.'"> ';
|
||||
print $formproduct->selectMeasuringUnits($object->net_measure_units, '', 0, 0, 0);
|
||||
print $formproduct->selectMeasuringUnits("net_measure_units", "", $object->net_measure_units, 0, 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
@ -1955,7 +1955,7 @@ else
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NetMeasure").'</td><td colspan="2">';
|
||||
if ($object->net_measure != '')
|
||||
{
|
||||
print $object->net_measure." ".measuringUnitString(0, "weight", $object->net_measure_units);
|
||||
print $object->net_measure." ".measuringUnitString($object->net_measure_units);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -256,14 +256,14 @@ if ($resql)
|
||||
}
|
||||
|
||||
$param = '';
|
||||
if ($tosell) $param .= "&tosell=".$tosell;
|
||||
if ($tobuy) $param .= "&tobuy=".$tobuy;
|
||||
if ($type) $param .= "&type=".$type;
|
||||
if ($fourn_id) $param .= "&fourn_id=".$fourn_id;
|
||||
if ($snom) $param .= "&snom=".$snom;
|
||||
if ($sref) $param .= "&sref=".$sref;
|
||||
if ($toolowstock) $param .= "&toolowstock=".$toolowstock;
|
||||
if ($search_categ) $param .= "&search_categ=".$search_categ;
|
||||
if ($tosell) $param .= "&tosell=".urlencode($tosell);
|
||||
if ($tobuy) $param .= "&tobuy=".urlencode($tobuy);
|
||||
if ($type) $param .= "&type=".urlencode($type);
|
||||
if ($fourn_id) $param .= "&fourn_id=".urlencode($fourn_id);
|
||||
if ($snom) $param .= "&snom=".urlencode($snom);
|
||||
if ($sref) $param .= "&sref=".urlencode($sref);
|
||||
if ($toolowstock) $param .= "&toolowstock=".urlencode($toolowstock);
|
||||
if ($search_categ) $param .= "&search_categ=".urlencode($search_categ);
|
||||
|
||||
$formProduct = new FormProduct($db);
|
||||
$formProduct->loadWarehouses();
|
||||
@ -362,7 +362,7 @@ if ($resql)
|
||||
// Real stock
|
||||
print '<td class="right">';
|
||||
if ($objp->seuil_stock_alerte != '' && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
||||
print $objp->stock_physique | 0;
|
||||
print price2num($objp->stock_physique, 'MS');
|
||||
print '</td>';
|
||||
|
||||
// Details per warehouse
|
||||
|
||||
@ -195,6 +195,7 @@ if ($action == 'order' && isset($_POST['valid']))
|
||||
|
||||
//we now know how many orders we need and what lines they have
|
||||
$i = 0;
|
||||
$fail = 0;
|
||||
$orders = array();
|
||||
$suppliersid = array_keys($suppliers);
|
||||
foreach ($suppliers as $supplier)
|
||||
@ -311,6 +312,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entre
|
||||
$sql .= ' pse.desiredstock as desiredstockpse, pse.seuil_stock_alerte as seuil_stock_alertepse,';
|
||||
}
|
||||
$sql .= ' '.$sqldesiredtock.' as desiredstockcombined, '.$sqlalertstock.' as seuil_stock_alertecombined,';
|
||||
$sql .= ' s.fk_product,';
|
||||
$sql .= ' SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique';
|
||||
|
||||
// Add fields from hooks
|
||||
@ -319,8 +321,8 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s';
|
||||
$sql .= ' ON (p.rowid = s.fk_product AND s.fk_entrepot IN (SELECT ent.rowid FROM '.MAIN_DB_PREFIX.'entrepot AS ent WHERE ent.entity IN('.getEntity('stock').')))';
|
||||
$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.')';
|
||||
}
|
||||
@ -360,36 +362,34 @@ $sql .= ', s.fk_product';
|
||||
|
||||
if ($usevirtualstock)
|
||||
{
|
||||
$sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd.qty) IS NULL", "0", "SUM(cd.qty)")." as qty";
|
||||
$sqlCommandesCli .= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
|
||||
$sqlCommandesCli .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON (c.rowid = cd.fk_commande)";
|
||||
$sqlCommandesCli .= " WHERE c.entity IN (".getEntity('commande').")";
|
||||
$sqlCommandesCli .= " AND cd.fk_product = p.rowid";
|
||||
$sqlCommandesCli .= " AND c.fk_statut IN (1,2))";
|
||||
$sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd1.qty) IS NULL", "0", "SUM(cd1.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
||||
$sqlCommandesCli .= " FROM ".MAIN_DB_PREFIX."commandedet as cd1, ".MAIN_DB_PREFIX."commande as c1";
|
||||
$sqlCommandesCli .= " WHERE c1.rowid = cd1.fk_commande AND c1.entity IN (".getEntity('commande').")";
|
||||
$sqlCommandesCli .= " AND cd1.fk_product = p.rowid";
|
||||
$sqlCommandesCli .= " AND c1.fk_statut IN (1,2))";
|
||||
|
||||
$sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed.qty) IS NULL", "0", "SUM(ed.qty)")." as qty";
|
||||
$sqlExpeditionsCli .= " FROM ".MAIN_DB_PREFIX."expedition as e";
|
||||
$sqlExpeditionsCli .= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet as ed ON (ed.fk_expedition = e.rowid)";
|
||||
$sqlExpeditionsCli .= " LEFT JOIN ".MAIN_DB_PREFIX."commandedet as cd ON (cd.rowid = ed.fk_origin_line)";
|
||||
$sqlExpeditionsCli .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON (c.rowid = cd.fk_commande)";
|
||||
$sqlExpeditionsCli .= " WHERE e.entity IN (".getEntity('expedition').")";
|
||||
$sqlExpeditionsCli .= " AND cd.fk_product = p.rowid";
|
||||
$sqlExpeditionsCli .= " AND e.fk_statut IN (1,2))";
|
||||
$sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed2.qty) IS NULL", "0", "SUM(ed2.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
||||
$sqlExpeditionsCli .= " FROM ".MAIN_DB_PREFIX."expedition as e2,";
|
||||
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."expeditiondet as ed2,";
|
||||
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commandedet as cd2";
|
||||
$sqlExpeditionsCli .= " WHERE ed2.fk_expedition = e2.rowid AND cd2.rowid = ed2.fk_origin_line AND e2.entity IN (".getEntity('expedition').")";
|
||||
$sqlExpeditionsCli .= " AND cd2.fk_product = p.rowid";
|
||||
$sqlExpeditionsCli .= " AND e2.fk_statut IN (1,2))";
|
||||
|
||||
$sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd.qty) IS NULL", "0", "SUM(cd.qty)")." as qty";
|
||||
$sqlCommandesFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd";
|
||||
$sqlCommandesFourn .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||
$sqlCommandesFourn .= " WHERE c.rowid = cd.fk_commande";
|
||||
$sqlCommandesFourn .= " AND c.entity IN (".getEntity('supplier_order').")";
|
||||
$sqlCommandesFourn .= " AND cd.fk_product = p.rowid";
|
||||
$sqlCommandesFourn .= " AND c.fk_statut IN (3,4))";
|
||||
$sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
||||
$sqlCommandesFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd3,";
|
||||
$sqlCommandesFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur as c3";
|
||||
$sqlCommandesFourn .= " WHERE c3.rowid = cd3.fk_commande";
|
||||
$sqlCommandesFourn .= " AND c3.entity IN (".getEntity('supplier_order').")";
|
||||
$sqlCommandesFourn .= " AND cd3.fk_product = p.rowid";
|
||||
$sqlCommandesFourn .= " AND c3.fk_statut IN (3,4))";
|
||||
|
||||
$sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd.qty) IS NULL", "0", "SUM(fd.qty)")." as qty";
|
||||
$sqlReceptionFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
||||
$sqlReceptionFourn .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd ON (fd.fk_commande = cf.rowid)";
|
||||
$sqlReceptionFourn .= " WHERE cf.entity IN (".getEntity('supplier_order').")";
|
||||
$sqlReceptionFourn .= " AND fd.fk_product = p.rowid";
|
||||
$sqlReceptionFourn .= " AND cf.fk_statut IN (3,4))";
|
||||
$sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd4.qty) IS NULL", "0", "SUM(fd4.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
||||
$sqlReceptionFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf4,";
|
||||
$sqlReceptionFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd4";
|
||||
$sqlReceptionFourn .= " WHERE fd4.fk_commande = cf4.rowid AND cf4.entity IN (".getEntity('supplier_order').")";
|
||||
$sqlReceptionFourn .= " AND fd4.fk_product = p.rowid";
|
||||
$sqlReceptionFourn .= " AND cf4.fk_statut IN (3,4))";
|
||||
|
||||
$sql .= ' HAVING (('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')';
|
||||
$sql .= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.')))';
|
||||
|
||||
@ -293,7 +293,7 @@ class Contacts extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->contact->oldcopy = clone $this->contact;
|
||||
return $this->contact->delete($id);
|
||||
return $this->contact->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
@ -85,8 +86,7 @@ if ($id)
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) $socid = $user->socid;
|
||||
$feature2 = 'user';
|
||||
|
||||
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
|
||||
$result = restrictedArea($user, 'user', $id, 'user', $feature2);
|
||||
|
||||
if ($user->id <> $id && !$canreaduser) accessforbidden();
|
||||
|
||||
@ -567,12 +567,14 @@ if (empty($reshook)) {
|
||||
|
||||
$object->fetch($id);
|
||||
|
||||
$object->oldcopy = clone $object;
|
||||
if (GETPOST("password", "none")) { // If pass is empty, we do not change it.
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$ret = $object->setPassword($user, GETPOST("password"));
|
||||
if ($ret < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$ret = $object->setPassword($user, GETPOST("password", "none"));
|
||||
if ($ret < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1551,7 +1553,7 @@ else
|
||||
else
|
||||
{
|
||||
if ($user->admin) $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
|
||||
else $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("Hidden");
|
||||
else $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -2307,7 +2309,11 @@ else
|
||||
print '<tr><td>'.$langs->trans("Gender").'</td>';
|
||||
print '<td>';
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
|
||||
print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1);
|
||||
if ($caneditfield) {
|
||||
print $form->selectarray('gender', $arraygender, GETPOSTISSET('gender') ?GETPOST('gender') : $object->gender, 1);
|
||||
} else {
|
||||
print $arraygender[$object->gender];
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Employee
|
||||
@ -2387,31 +2393,50 @@ else
|
||||
|
||||
// Address
|
||||
print '<tr><td class="tdtop titlefield">'.$form->editfieldkey('Address', 'address', '', $object, 0).'</td>';
|
||||
print '<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
|
||||
print '<td>';
|
||||
if ($caneditfield) print '<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
|
||||
print $object->address;
|
||||
print '</textarea></td></tr>';
|
||||
if ($caneditfield) print '</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip
|
||||
print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td>';
|
||||
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
|
||||
if ($caneditfield) {
|
||||
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
|
||||
} else {
|
||||
print $object->zip;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Town
|
||||
print '<tr><td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>';
|
||||
print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
|
||||
if ($caneditfield) {
|
||||
print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
|
||||
} else {
|
||||
print $object->town;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).'</td><td>';
|
||||
print $form->select_country((GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id), 'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
if ($caneditfield) {
|
||||
print $form->select_country((GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id), 'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
} else {
|
||||
$countrylabel = getCountry($object->country_id, '0');
|
||||
print $countrylabel;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// State
|
||||
if (empty($conf->global->USER_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td class="tdoverflow">'.$form->editfieldkey('State', 'state_id', '', $object, 0).'</td><td>';
|
||||
print $formcompany->select_state($object->state_id, $object->country_code, 'state_id');
|
||||
if ($caneditfield) {
|
||||
print $formcompany->select_state($object->state_id, $object->country_code, 'state_id');
|
||||
} else {
|
||||
print $object->state_label;
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user