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

This commit is contained in:
Laurent Destailleur
2022-02-10 16:28:29 +01:00
6 changed files with 41 additions and 26 deletions

View File

@@ -544,7 +544,7 @@ if ($id > 0 || !empty($ref)) {
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
$buttonreconcile = '<a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&amp;sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliatemanual.'</a>';
$buttonreconcile = '<a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc,desc,desc&search_conciliated=0'.$newparam.'">'.$titletoconciliatemanual.'</a>';
} else {
$buttonreconcile = '<a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliatemanual.'</a>';
}
@@ -554,7 +554,7 @@ if ($id > 0 || !empty($ref)) {
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&amp;sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc,desc,desc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
} else {
$buttonreconcile .= ' <a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliateauto.'</a>';
}

View File

@@ -626,7 +626,7 @@ foreach ($accounts as $key => $type) {
if ($result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&id='.$objecttmp->id.'&search_account='.$objecttmp->id.'&search_conciliated=0&contextpage=banktransactionlist">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc,desc,desc&id='.$objecttmp->id.'&search_account='.$objecttmp->id.'&search_conciliated=0&contextpage=banktransactionlist">';
print '<span class="badge badge-info classfortooltip" title="'.dol_htmlentities($langs->trans("TransactionsToConciliate")).'">';
print $result->nbtodo;
print '</span>';

View File

@@ -275,7 +275,7 @@ if (empty($numref)) {
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) {
$buttonreconcile = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$id.$param.'">'.$titletoconciliatemanual.'</a>';
$buttonreconcile = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc,desc,desc&search_conciliated=0&search_account='.$id.$param.'">'.$titletoconciliatemanual.'</a>';
} else {
$buttonreconcile = '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliatemanual.'</a>';
}
@@ -286,7 +286,7 @@ if (empty($numref)) {
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&amp;sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc,desc,desc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
} else {
$buttonreconcile .= ' <a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliateauto.'</a>';
}

View File

@@ -88,7 +88,7 @@ $datelivraison = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'
// Security check
if ($user->socid) {
if (!empty($user->socid)) {
$socid = $user->socid;
}
@@ -162,6 +162,8 @@ if (!empty($conf->projet->enabled)) {
$caneditproject = empty($conf->global->SUPPLIER_ORDER_FORBID_EDIT_PROJECT) || ($object->statut == CommandeFournisseur::STATUS_DRAFT && preg_match('/^[\(]?PROV/i', $object->ref));
}
$error = 0;
/*
* Actions
@@ -181,7 +183,7 @@ if (empty($reshook)) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/fourn/commande/card.php?id='.($id > 0 ? $id : '__ID__');
$backtopage = DOL_URL_ROOT.'/fourn/commande/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
}
@@ -410,22 +412,27 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product
$predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') {
$idprod = 0;
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
} else {
$idprod = GETPOST('idprod', 'int');
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$tva_tx = '';
}
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)'
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
if (empty($remise_percent)) {
$remise_percent = 0;
}
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -530,7 +537,7 @@ if (empty($reshook)) {
}
//If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time
if ($product_desc==$desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) {
if (trim($product_desc) == trim($desc) && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) {
$product_desc='';
}
@@ -541,11 +548,17 @@ if (empty($reshook)) {
$desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
}
$ref_supplier = $productsupplier->ref_supplier;
$type = $productsupplier->type;
if ($price_ht != '' || $price_ht_devise != '') {
if (GETPOST('price_ht') != '' || GETPOST('price_ht_devise') != '') {
$price_base_type = 'HT';
$pu = price2num($price_ht, 'MU');
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$pu_ht_devise = price2num($price_ht_devise, 'CU');
} elseif (GETPOST('price_ttc') != '' || GETPOST('price_ttc_devise') != '') {
$price_base_type = 'TTC';
$pu = price2num($price_ttc, 'MU');
$pu_ht_devise = price2num($price_ttc_devise, 'CU');
} else {
$price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT');
if (empty($object->multicurrency_code) || ($productsupplier->fourn_multicurrency_code != $object->multicurrency_code)) { // If object is in a different currency and price not in this currency
@@ -554,13 +567,9 @@ if (empty($reshook)) {
} else {
$pu = $productsupplier->fourn_pu;
$pu_ht_devise = $productsupplier->fourn_multicurrency_unitprice;
/*var_dump($pu);
var_dump($pu_ht_devise);exit;*/
}
}
$ref_supplier = $productsupplier->ref_supplier;
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha'));
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha'));
if (empty($tva_tx)) {
@@ -621,22 +630,22 @@ if (empty($reshook)) {
$fk_unit = GETPOST('units', 'alpha');
if (!preg_match('/\((.*)\)/', $tva_tx)) {
$tva_tx = price2num($tva_tx); // When vat is text input field
$tva_tx = price2num($tva_tx); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
}
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
$localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
if ($price_ht !== '') {
if (GETPOST('price_ht') != '' || GETPOST('price_ht_devise') != '') {
$pu_ht = price2num($price_ht, 'MU'); // $pu_ht must be rounded according to settings
} else {
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings
}
$price_base_type = 'HT';
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$pu_ht_devise = price2num($price_ht_devise, 'CU');
// var_dump($pu_ht.' '.$tva_tx.' '.$pu_ttc.' '.$price_base_type.' '.$pu_ht_devise); exit;
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, '', '', $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise);
}
@@ -687,6 +696,7 @@ if (empty($reshook)) {
unset($_POST['np_markRate']);
unset($_POST['dp_desc']);
unset($_POST['idprodfournprice']);
unset($_POST['units']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);

View File

@@ -1381,6 +1381,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'addline' && $usercancreate) {
// Add a product line
$db->begin();
$ret = $object->fetch($id);
@@ -1413,7 +1414,11 @@ if (empty($reshook)) {
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
if (empty($remise_percent)) {
$remise_percent = 0;
}
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);

View File

@@ -586,7 +586,7 @@ insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (307, 'LT', NULL, NULL, NULL, 'LATINA');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (313, 'LE', NULL, NULL, NULL, 'LECCE');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (309, 'LC', NULL, NULL, NULL, 'LECCO');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (314, 'LI', NULL, NULL, NULL, 'LIVORNO');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (316, 'LI', NULL, NULL, NULL, 'LIVORNO');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (309, 'LO', NULL, NULL, NULL, 'LODI');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (316, 'LU', NULL, NULL, NULL, 'LUCCA');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (310, 'MC', NULL, NULL, NULL, 'MACERATA');