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
BIN
dev/initdemo/documents_demo/adherent/1/photos/person5.jpeg
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
BIN
dev/initdemo/documents_demo/adherent/2/photos/pierrecurie.jpg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
BIN
dev/initdemo/documents_demo/adherent/3/photos/person9.jpeg
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
BIN
dev/initdemo/documents_demo/adherent/4/photos/person2.jpeg
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
@ -413,7 +413,6 @@ if ($result) {
|
||||
|
||||
$objp->code_sell_l = '';
|
||||
$objp->code_sell_p = '';
|
||||
$objp->aarowid_suggest = '';
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
@ -425,7 +424,7 @@ if ($result) {
|
||||
$facture_static->type = $objp->ftype;
|
||||
|
||||
$code_sell_p_notset = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$objp->aarowid_suggest = ''; // Will be set later
|
||||
|
||||
$isBuyerInEEC = isInEEC($objp);
|
||||
|
||||
@ -459,8 +458,9 @@ if ($result) {
|
||||
}
|
||||
if ($objp->code_sell_l == -1) $objp->code_sell_l='';
|
||||
|
||||
// Search suggested account for product/service
|
||||
$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->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
@ -549,12 +549,19 @@ if ($result) {
|
||||
|
||||
// Suggested accounting account
|
||||
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>';
|
||||
|
||||
// Column with checkbox
|
||||
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 '</tr>';
|
||||
|
||||
@ -521,12 +521,14 @@ if ($result) {
|
||||
|
||||
// Suggested accounting account
|
||||
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>';
|
||||
|
||||
// Column with checkbox
|
||||
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 '</tr>';
|
||||
|
||||
@ -174,15 +174,15 @@ if ($action == 'maj_pattern')
|
||||
$explodePattern = explode(';', $pattern);
|
||||
|
||||
$patternInError = false;
|
||||
if($explodePattern[0] < 1 || $explodePattern[4] < 0){
|
||||
if ($explodePattern[0] < 1 || $explodePattern[4] < 0) {
|
||||
$patternInError = true;
|
||||
}
|
||||
|
||||
if($explodePattern[0] < $explodePattern[1] + $explodePattern[2] + $explodePattern[3]){
|
||||
if ($explodePattern[0] < $explodePattern[1] + $explodePattern[2] + $explodePattern[3]) {
|
||||
$patternInError = true;
|
||||
}
|
||||
|
||||
if(!$patternInError){
|
||||
if (!$patternInError) {
|
||||
dolibarr_set_const($db, "USER_PASSWORD_PATTERN", $pattern, 'chaine', 0, '', $conf->entity);
|
||||
header("Location: security.php");
|
||||
exit;
|
||||
|
||||
@ -864,11 +864,14 @@ class Categorie extends CommonObject
|
||||
if ($type=="contact") {
|
||||
$subcol_name="fk_socpeople";
|
||||
}
|
||||
|
||||
$idoftype = array_search($type, self::$MAP_ID_TO_CODE);
|
||||
|
||||
$sql = "SELECT s.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
|
||||
$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 sub.'.$subcol_name.' = '.$id;
|
||||
|
||||
@ -887,7 +890,15 @@ class Categorie extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= $this->db->plimit($limit + 1, $offset);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
|
||||
@ -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...)
|
||||
* @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...)
|
||||
* @see formproduct->selectMeasuringUnits
|
||||
*/
|
||||
|
||||
@ -176,9 +176,11 @@ class modProduct extends DolibarrModules
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'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.duration'=>"Duration",
|
||||
'p.duration'=>"Duration",
|
||||
'p.finished' => 'Nature',
|
||||
'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 (! 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->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
$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.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.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",
|
||||
'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'
|
||||
//'p.duration'=>"Duree",
|
||||
'p.customcode'=>'Text',
|
||||
'p.duration'=>"Text",
|
||||
'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->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(
|
||||
'p.fk_unit' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
|
||||
@ -149,10 +149,12 @@ class modService extends DolibarrModules
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'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.finished' => 'Nature',
|
||||
'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 (! 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->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
$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.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.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",
|
||||
'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date',
|
||||
'p.duration'=>"Duree",
|
||||
'p.customcode'=>'Text',
|
||||
'p.duration'=>"Text",
|
||||
'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->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(
|
||||
'p.fk_unit' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
|
||||
@ -187,31 +187,31 @@ class modGeneratePassPerso extends ModeleGenPassword
|
||||
$spe = str_split($this->Spe);
|
||||
|
||||
if (count(array_intersect($password_a, $maj)) < $this->NbMaj) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (count(array_intersect($password_a, $num)) < $this->NbNum) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (count(array_intersect($password_a, $spe)) < $this->NbSpe) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
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
|
||||
* @return int 0 if KO, >0 if OK
|
||||
* @return bool
|
||||
*/
|
||||
public function consecutiveInterationSameCharacter($password)
|
||||
private function consecutiveInterationSameCharacter($password)
|
||||
{
|
||||
$last = "";
|
||||
|
||||
@ -224,14 +224,16 @@ class modGeneratePassPerso extends ModeleGenPassword
|
||||
if($c != $last) {
|
||||
$last = $c;
|
||||
$count = 0;
|
||||
} else {
|
||||
$count++;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($count >= $this->NbRepeat) {
|
||||
return 0;
|
||||
$count++;
|
||||
if ($count > $this->NbRepeat) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ MarginDetails=Margin details
|
||||
ProductMargins=Product margins
|
||||
CustomerMargins=Customer margins
|
||||
SalesRepresentativeMargins=Sales representative margins
|
||||
ContactOfInvoice=Contact of invoice
|
||||
UserMargins=User margins
|
||||
ProductService=Product or Service
|
||||
AllProducts=All products and services
|
||||
@ -36,7 +37,7 @@ CostPrice=Cost price
|
||||
UnitCharges=Unit charges
|
||||
Charges=Charges
|
||||
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
|
||||
markRateShouldBeLesserThan100=Mark rate should be lower than 100
|
||||
ShowMarginInfos=Show margin infos
|
||||
|
||||
@ -109,7 +109,7 @@ dol_fiche_head($head, 'agentMargins', $titre, 0, $picto);
|
||||
|
||||
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 $form->select_dolusers($agentid, 'agentid', 1, '', $user->rights->margins->read->all ? 0 : 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
@ -54,6 +54,7 @@ $ok=false;
|
||||
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->hrm->read)) $ok=true;
|
||||
if (! empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) $ok=true;
|
||||
if (! $ok)
|
||||
{
|
||||
accessforbidden();
|
||||
|
||||
@ -1297,7 +1297,7 @@ class User extends CommonObject
|
||||
|
||||
$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);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||