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

Conflicts:
	htdocs/langs/en_US/margins.lang
	htdocs/user/class/user.class.php
This commit is contained in:
Laurent Destailleur 2019-10-10 10:37:17 +02:00
commit aebae5ff83
25 changed files with 165 additions and 123 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

File diff suppressed because one or more lines are too long

View File

@ -413,7 +413,6 @@ if ($result) {
$objp->code_sell_l = ''; $objp->code_sell_l = '';
$objp->code_sell_p = ''; $objp->code_sell_p = '';
$objp->aarowid_suggest = '';
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;
@ -425,7 +424,7 @@ if ($result) {
$facture_static->type = $objp->ftype; $facture_static->type = $objp->ftype;
$code_sell_p_notset = ''; $code_sell_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid; $objp->aarowid_suggest = ''; // Will be set later
$isBuyerInEEC = isInEEC($objp); $isBuyerInEEC = isInEEC($objp);
@ -459,8 +458,9 @@ if ($result) {
} }
if ($objp->code_sell_l == -1) $objp->code_sell_l=''; if ($objp->code_sell_l == -1) $objp->code_sell_l='';
// Search suggested account for product/service
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_p = $objp->code_sell; $objp->code_sell_p = $objp->code_sell;
$objp->aarowid_suggest = $objp->aarowid; $objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
@ -549,12 +549,19 @@ if ($result) {
// Suggested accounting account // Suggested accounting account
print '<td>'; print '<td>';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); $suggestedid = $objp->aarowid_suggest;
if (empty($suggestedid) && empty($objp->code_sell_p) && ! empty($objp->code_sell_l) && ! empty($conf->global->ACCOUNTANCY_AUTOFILL_ACCOUNT_WITH_GENERIC))
{
//$suggestedid = // id of $objp->code_sell_l
}
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>'; print '</td>';
// Column with checkbox // Column with checkbox
print '<td class="center">'; print '<td class="center">';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; //var_dump($objp->aarowid);var_dump($objp->aarowid_intra);var_dump($objp->aarowid_export);var_dump($objp->aarowid_suggest);
$ischecked = $objp->aarowid_suggest;
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($ischecked ? "checked" : "") . '/>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -521,12 +521,14 @@ if ($result) {
// Suggested accounting account // Suggested accounting account
print '<td>'; print '<td>';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); $suggestedid = $objp->aarowid_suggest;
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>'; print '</td>';
// Column with checkbox // Column with checkbox
print '<td class="center">'; print '<td class="center">';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; $ischecked = $objp->aarowid_suggest;
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($ischecked ? "checked" : "") . '/>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -864,11 +864,14 @@ class Categorie extends CommonObject
if ($type=="contact") { if ($type=="contact") {
$subcol_name="fk_socpeople"; $subcol_name="fk_socpeople";
} }
$idoftype = array_search($type, self::$MAP_ID_TO_CODE);
$sql = "SELECT s.rowid"; $sql = "SELECT s.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
$sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub "; $sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
$sql.= ' WHERE s.entity IN ('.getEntity('category').')'; $sql.= ' WHERE s.entity IN ('.getEntity('category').')';
$sql.= ' AND s.type='.array_search($type, self::$MAP_ID_TO_CODE); $sql.= ' AND s.type='.$idoftype;
$sql.= ' AND s.rowid = sub.fk_categorie'; $sql.= ' AND s.rowid = sub.fk_categorie';
$sql.= ' AND sub.'.$subcol_name.' = '.$id; $sql.= ' AND sub.'.$subcol_name.' = '.$id;
@ -887,7 +890,15 @@ class Categorie extends CommonObject
} }
} }
if ($limit) {
if ($page < 0)
{
$page = 0;
}
$offset = $limit * $page;
$sql.= $this->db->plimit($limit + 1, $offset); $sql.= $this->db->plimit($limit + 1, $offset);
}
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)

View File

@ -527,9 +527,9 @@ function measuring_units_string($unit, $measuring_style = '', $scale = '', $use_
} }
/** /**
* Transform a given unit into the square of that unit, if known * Transform a given unit scale into the square of that unit, if known.
* *
* @param int $unit Unit key (-3,-2,-1,0,98,99...) * @param int $unit Unit scale key (-3,-2,-1,0,98,99...)
* @return int Squared unit key (-6,-4,-2,0,98,99...) * @return int Squared unit key (-6,-4,-2,0,98,99...)
* @see formproduct->selectMeasuringUnits * @see formproduct->selectMeasuringUnits
*/ */
@ -547,9 +547,9 @@ function measuring_units_squared($unit)
/** /**
* Transform a given unit into the cube of that unit, if known * Transform a given unit scale into the cube of that unit, if known
* *
* @param int $unit Unit key (-3,-2,-1,0,98,99...) * @param int $unit Unit scale key (-3,-2,-1,0,98,99...)
* @return int Cubed unit key (-9,-6,-3,0,88,89...) * @return int Cubed unit key (-9,-6,-3,0,88,89...)
* @see formproduct->selectMeasuringUnits * @see formproduct->selectMeasuringUnits
*/ */

View File

@ -176,9 +176,11 @@ class modProduct extends DolibarrModules
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode", 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic', 'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
'p.weight'=>"Weight",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume", 'p.weight'=>"Weight",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume",
//'p.duration'=>"Duration", 'p.duration'=>"Duration",
'p.finished' => 'Nature',
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC", 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",
'p.tva_tx'=>'VATRate','p.datec'=>'DateCreation','p.tms'=>'DateModification' 'p.tva_tx'=>'VATRate',
'p.datec'=>'DateCreation','p.tms'=>'DateModification'
); );
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR'; if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
@ -191,13 +193,17 @@ class modProduct extends DolibarrModules
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit'; if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
$this->export_TypeFields_array[$r]=array( $this->export_TypeFields_array[$r]=array(
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text", 'p.ref'=>"Text",'p.label'=>"Text",
'p.fk_product_type'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",
'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
'p.note'=>"Text",'p.note_public'=>"Text", 'p.note'=>"Text",'p.note_public'=>"Text",
'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric", 'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",
'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean", 'p.customcode'=>'Text',
'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date' 'p.duration'=>"Text",
//'p.duration'=>"Duree", 'p.finished' => 'Numeric',
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric',
'p.datec'=>'Date','p.tms'=>'Date'
); );
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
@ -552,6 +558,7 @@ class modProduct extends DolibarrModules
) )
); );
if (! is_array($this->import_convertvalue_array[$r])) $this->import_convertvalue_array[$r] = array();
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array( $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
'p.fk_unit' => array( 'p.fk_unit' => array(
'rule' => 'fetchidfromcodeorlabel', 'rule' => 'fetchidfromcodeorlabel',

View File

@ -149,10 +149,12 @@ class modService extends DolibarrModules
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode", 'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode", 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic', 'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
//'p.weight'=>"Weight",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume", 'p.weight'=>"Weight",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume",
'p.duration'=>"Duration", 'p.duration'=>"Duration",
'p.finished' => 'Nature',
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC", 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",
'p.tva_tx'=>'VATRate','p.datec'=>'DateCreation','p.tms'=>'DateModification' 'p.tva_tx'=>'VATRate',
'p.datec'=>'DateCreation','p.tms'=>'DateModification'
); );
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR'; if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
@ -165,13 +167,17 @@ class modService extends DolibarrModules
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit'; if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
$this->export_TypeFields_array[$r]=array( $this->export_TypeFields_array[$r]=array(
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text", 'p.ref'=>"Text",'p.label'=>"Text",
'p.fk_product_type'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",
'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
'p.note'=>"Text",'p.note_public'=>"Text", 'p.note'=>"Text",'p.note_public'=>"Text",
'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric", 'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",
'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean", 'p.customcode'=>'Text',
'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date', 'p.duration'=>"Text",
'p.duration'=>"Duree", 'p.finished' => 'Numeric',
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric',
'p.datec'=>'Date','p.tms'=>'Date'
); );
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
@ -527,6 +533,7 @@ class modService extends DolibarrModules
) )
); );
if (! is_array($this->import_convertvalue_array[$r])) $this->import_convertvalue_array[$r] = array();
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array( $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
'p.fk_unit' => array( 'p.fk_unit' => array(
'rule' => 'fetchidfromcodeorlabel', 'rule' => 'fetchidfromcodeorlabel',

View File

@ -187,31 +187,31 @@ class modGeneratePassPerso extends ModeleGenPassword
$spe = str_split($this->Spe); $spe = str_split($this->Spe);
if (count(array_intersect($password_a, $maj)) < $this->NbMaj) { if (count(array_intersect($password_a, $maj)) < $this->NbMaj) {
return 0; return false;
} }
if (count(array_intersect($password_a, $num)) < $this->NbNum) { if (count(array_intersect($password_a, $num)) < $this->NbNum) {
return 0; return false;
} }
if (count(array_intersect($password_a, $spe)) < $this->NbSpe) { if (count(array_intersect($password_a, $spe)) < $this->NbSpe) {
return 0; return false;
} }
if (!$this->consecutiveInterationSameCharacter($password)) { if (!$this->consecutiveInterationSameCharacter($password)) {
return 0; return false;
} }
return 1; return true;
} }
/** /**
* Consecutive iterations of the same character * Check the consecutive iterations of the same character. Return false if the number doesn't match the maximum consecutive value allowed.
* *
* @param string $password Password to check * @param string $password Password to check
* @return int 0 if KO, >0 if OK * @return bool
*/ */
public function consecutiveInterationSameCharacter($password) private function consecutiveInterationSameCharacter($password)
{ {
$last = ""; $last = "";
@ -224,14 +224,16 @@ class modGeneratePassPerso extends ModeleGenPassword
if($c != $last) { if($c != $last) {
$last = $c; $last = $c;
$count = 0; $count = 0;
} else {
$count++; continue;
} }
if ($count >= $this->NbRepeat) { $count++;
return 0; if ($count > $this->NbRepeat) {
return false;
} }
} }
return 1;
return true;
} }
} }

View File

@ -16,6 +16,7 @@ MarginDetails=Margin details
ProductMargins=Product margins ProductMargins=Product margins
CustomerMargins=Customer margins CustomerMargins=Customer margins
SalesRepresentativeMargins=Sales representative margins SalesRepresentativeMargins=Sales representative margins
ContactOfInvoice=Contact of invoice
UserMargins=User margins UserMargins=User margins
ProductService=Product or Service ProductService=Product or Service
AllProducts=All products and services AllProducts=All products and services
@ -36,7 +37,7 @@ CostPrice=Cost price
UnitCharges=Unit charges UnitCharges=Unit charges
Charges=Charges Charges=Charges
AgentContactType=Commercial agent contact type AgentContactType=Commercial agent contact type
AgentContactTypeDetails=Define what contact type (linked on invoices) will be used for margin report per sale representative. Note that reading statistics on a sale representative as a contact is not reliable since in most cases the contact may not be defined explicitely on the invoices. AgentContactTypeDetails=Define what contact type (linked on invoices) will be used for margin report per contact/address. Note that reading statistics on a contact is not reliable since in most cases the contact may not be defined explicitely on the invoices.
rateMustBeNumeric=Rate must be a numeric value rateMustBeNumeric=Rate must be a numeric value
markRateShouldBeLesserThan100=Mark rate should be lower than 100 markRateShouldBeLesserThan100=Mark rate should be lower than 100
ShowMarginInfos=Show margin infos ShowMarginInfos=Show margin infos

View File

@ -109,7 +109,7 @@ dol_fiche_head($head, 'agentMargins', $titre, 0, $picto);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans('SalesRepresentative').'</td>'; print '<tr><td class="titlefield">'.$langs->trans('ContactOfInvoice').'</td>';
print '<td class="maxwidthonsmartphone" colspan="4">'; print '<td class="maxwidthonsmartphone" colspan="4">';
print $form->select_dolusers($agentid, 'agentid', 1, '', $user->rights->margins->read->all ? 0 : 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print $form->select_dolusers($agentid, 'agentid', 1, '', $user->rights->margins->read->all ? 0 : 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '</td></tr>'; print '</td></tr>';

View File

@ -54,6 +54,7 @@ $ok=false;
if ($user->id == $id) $ok=true; // A user can always read its own card if ($user->id == $id) $ok=true; // A user can always read its own card
if (! empty($user->rights->salaries->read)) $ok=true; if (! empty($user->rights->salaries->read)) $ok=true;
if (! empty($user->rights->hrm->read)) $ok=true; if (! empty($user->rights->hrm->read)) $ok=true;
if (! empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) $ok=true;
if (! $ok) if (! $ok)
{ {
accessforbidden(); accessforbidden();

View File

@ -1297,7 +1297,7 @@ class User extends CommonObject
$this->db->begin(); $this->db->begin();
// Cree et positionne $this->id // Create user and set $this->id. Trigger is disabled because executed later.
$result=$this->create($user, 1); $result=$this->create($user, 1);
if ($result > 0) if ($result > 0)
{ {