Merge branch 'Dolibarr:develop' into dolibarr_fixbugs
This commit is contained in:
commit
3c68283c8e
@ -875,7 +875,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '' && $usercancreate) {
|
||||
// Define vat_rate
|
||||
// Define a vat_rate for all lines
|
||||
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
|
||||
@ -884,7 +884,7 @@ if (empty($reshook)) {
|
||||
$result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
}
|
||||
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('remiseforalllines', 'alpha') !== '' && $usercancreate) {
|
||||
// Define vat_rate
|
||||
// Define a discount for all lines
|
||||
$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0);
|
||||
$remise_percent = str_replace('*', '', $remise_percent);
|
||||
foreach ($object->lines as $line) {
|
||||
@ -894,22 +894,36 @@ 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);
|
||||
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
|
||||
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
|
||||
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode');
|
||||
$price_ht = '';
|
||||
$price_ht_devise = '';
|
||||
$price_ttc = '';
|
||||
$price_ttc_devise = '';
|
||||
|
||||
if (GETPOST('price_ht') !== '') {
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
|
||||
}
|
||||
if (GETPOST('multicurrency_price_ht') !== '') {
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
|
||||
}
|
||||
if (GETPOST('price_ttc') !== '') {
|
||||
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
|
||||
}
|
||||
if (GETPOST('multicurrency_price_ttc') !== '') {
|
||||
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
|
||||
}
|
||||
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09');
|
||||
if ($prod_entry_mode == 'free') {
|
||||
$idprod = 0;
|
||||
$tva_tx = (GETPOST('tva_tx') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx'))) : 0);
|
||||
$tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0);
|
||||
} else {
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
|
||||
$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;
|
||||
}
|
||||
@ -930,7 +944,7 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && $price_ht === '' && $price_ht_devise === '') { // Unit price can be 0 but not ''. Also price can be negative for proposal.
|
||||
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && $price_ht === '' && $price_ht_devise === '' && $price_ttc === '' && $price_ttc_devise === '') { // Unit price can be 0 but not ''. Also price can be negative for proposal.
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
@ -1077,13 +1091,15 @@ if (empty($reshook)) {
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
|
||||
// Set unit price to use
|
||||
if (!empty($price_ht) || $price_ht === '0') {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
} elseif (!empty($price_ttc) || $price_ttc === '0') {
|
||||
$pu_ttc = price2num($price_ttc, 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} elseif ($tmpvat != $tmpprodvat) {
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
// Is this still used ?
|
||||
if ($price_base_type != 'HT') {
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} else {
|
||||
@ -1170,16 +1186,22 @@ if (empty($reshook)) {
|
||||
$fk_unit = $prod->fk_unit;
|
||||
} else {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
|
||||
$pu_ttc = price2num($price_ttc, 'MU');
|
||||
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
|
||||
if (empty($tva_tx)) {
|
||||
$tva_npr = 0;
|
||||
}
|
||||
$tva_tx = str_replace('*', '', $tva_tx);
|
||||
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
|
||||
$desc = $product_desc;
|
||||
$type = GETPOST('type');
|
||||
|
||||
$fk_unit = GETPOST('units', 'alpha');
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
$pu_ttc_devise = price2num($price_ttc_devise, 'MU');
|
||||
|
||||
if ($pu_ttc && !$pu_ht) {
|
||||
$price_base_type = 'TTC';
|
||||
}
|
||||
}
|
||||
|
||||
// Margin
|
||||
@ -1298,7 +1320,7 @@ if (empty($reshook)) {
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
|
||||
//$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
|
||||
$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
|
||||
|
||||
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
@ -1382,7 +1404,14 @@ if (empty($reshook)) {
|
||||
|
||||
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
|
||||
|
||||
$result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise);
|
||||
$pu = $pu_ht;
|
||||
$price_base_type = 'HT';
|
||||
if (empty($pu) && ! empty($pu_ttc)) {
|
||||
$pu = $pu_ttc;
|
||||
$price_base_type = 'TTC';
|
||||
}
|
||||
|
||||
$result = $object->updateline(GETPOST('lineid', 'int'), $pu, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, $price_base_type, $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise);
|
||||
|
||||
if ($result >= 0) {
|
||||
$db->commit();
|
||||
@ -2696,7 +2725,7 @@ if ($action == 'create') {
|
||||
* Lines
|
||||
*/
|
||||
|
||||
// Show object lines
|
||||
// Get object lines
|
||||
$result = $object->getLinesArray();
|
||||
|
||||
// Add products/services form
|
||||
@ -2704,7 +2733,7 @@ if ($action == 'create') {
|
||||
global $inputalsopricewithtax;
|
||||
$inputalsopricewithtax = 1;
|
||||
|
||||
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
|
||||
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">
|
||||
<input type="hidden" name="token" value="' . newToken().'">
|
||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
|
||||
<input type="hidden" name="mode" value="">
|
||||
|
||||
@ -932,9 +932,6 @@ class Propal extends CommonObject
|
||||
$this->line->date_start = $date_start;
|
||||
$this->line->date_end = $date_end;
|
||||
|
||||
// TODO deprecated
|
||||
$this->line->price = $price;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
// We replace values in this->line->array_options only for entries defined into $array_options
|
||||
foreach ($array_options as $key => $value) {
|
||||
|
||||
@ -646,22 +646,35 @@ 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);
|
||||
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
|
||||
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
|
||||
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode');
|
||||
$price_ht = '';
|
||||
$price_ht_devise = '';
|
||||
$price_ttc = '';
|
||||
$price_ttc_devise = '';
|
||||
|
||||
if (GETPOST('price_ht') !== '') {
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
|
||||
}
|
||||
if (GETPOST('multicurrency_price_ht') !== '') {
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
|
||||
}
|
||||
if (GETPOST('price_ttc') !== '') {
|
||||
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
|
||||
}
|
||||
if (GETPOST('multicurrency_price_ttc') !== '') {
|
||||
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
|
||||
}
|
||||
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09');
|
||||
if ($prod_entry_mode == 'free') {
|
||||
$idprod = 0;
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0);
|
||||
} else {
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
|
||||
|
||||
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
|
||||
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
|
||||
if (empty($remise_percent)) {
|
||||
$remise_percent = 0;
|
||||
@ -686,7 +699,7 @@ if (empty($reshook)) {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && $price_ht == '' && $price_ht_devise == '') { // Unit price can be 0 but not ''. Also price can be negative for order.
|
||||
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && $price_ht === '' && $price_ht_devise === '' && $price_ttc === '' && $price_ttc_devise === '') { // Unit price can be 0 but not ''. Also price can be negative for order.
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
@ -835,13 +848,15 @@ if (empty($reshook)) {
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
|
||||
// Set unit price to use
|
||||
if (!empty($price_ht) || $price_ht === '0') {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
} elseif (!empty($price_ttc) || $price_ttc === '0') {
|
||||
$pu_ttc = price2num($price_ttc, 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} elseif ($tmpvat != $tmpprodvat) {
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
// Is this still used ?
|
||||
if ($price_base_type != 'HT') {
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} else {
|
||||
@ -928,14 +943,22 @@ if (empty($reshook)) {
|
||||
$fk_unit = $prod->fk_unit;
|
||||
} else {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
|
||||
$pu_ttc = price2num($price_ttc, 'MU');
|
||||
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
|
||||
$tva_tx = str_replace('*', '', $tva_tx);
|
||||
if (empty($tva_tx)) {
|
||||
$tva_npr = 0;
|
||||
}
|
||||
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
|
||||
$desc = $product_desc;
|
||||
$type = GETPOST('type');
|
||||
$fk_unit = GETPOST('units', 'alpha');
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
$pu_ttc_devise = price2num($price_ttc_devise, 'MU');
|
||||
|
||||
if ($pu_ttc && !$pu_ht) {
|
||||
$price_base_type = 'TTC';
|
||||
}
|
||||
}
|
||||
|
||||
// Margin
|
||||
@ -946,13 +969,13 @@ if (empty($reshook)) {
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
|
||||
|
||||
$desc = dol_htmlcleanlastbr($desc);
|
||||
|
||||
$info_bits = 0;
|
||||
if ($tva_npr) {
|
||||
$info_bits |= 0x01;
|
||||
}
|
||||
|
||||
$desc = dol_htmlcleanlastbr($desc);
|
||||
|
||||
if ($usermustrespectpricemin) {
|
||||
if ($pu_ht && $price_min && ((price2num($pu_ht) * (1 - $remise_percent / 100)) < price2num($price_min))) {
|
||||
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
|
||||
@ -1035,12 +1058,14 @@ if (empty($reshook)) {
|
||||
$description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml'));
|
||||
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx', 'alpha') : 0);
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
|
||||
$pu_ht = price2num(GETPOST('price_ht'), '', 2);
|
||||
$pu_ttc = price2num(GETPOST('price_ttc'), '', 2);
|
||||
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
|
||||
//$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
|
||||
|
||||
$qty = price2num(GETPOST('qty'), 'MS');
|
||||
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
|
||||
$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
|
||||
|
||||
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
@ -1135,7 +1160,15 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
|
||||
|
||||
$price_base_type = 'HT';
|
||||
$pu = $pu_ht;
|
||||
if (empty($pu) && ! empty($pu_ttc)) {
|
||||
$pu = $pu_ttc;
|
||||
$price_base_type = 'TTC';
|
||||
}
|
||||
|
||||
$result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $price_base_type, $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
|
||||
|
||||
if ($result >= 0) {
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
@ -2678,9 +2711,16 @@ if ($action == 'create' && $usercancreate) {
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
|
||||
// Get object lines
|
||||
$result = $object->getLinesArray();
|
||||
|
||||
print '<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
|
||||
// Add products/services form
|
||||
//$forceall = 1;
|
||||
global $inputalsopricewithtax;
|
||||
$inputalsopricewithtax = 1;
|
||||
|
||||
print '<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">
|
||||
<input type="hidden" name="token" value="' . newToken().'">
|
||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
|
||||
<input type="hidden" name="mode" value="">
|
||||
|
||||
@ -2008,22 +2008,39 @@ 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);
|
||||
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
|
||||
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
|
||||
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode', 'alpha');
|
||||
$price_ht = '';
|
||||
$price_ht_devise = '';
|
||||
$price_ttc = '';
|
||||
$price_ttc_devise = '';
|
||||
|
||||
if (GETPOST('price_ht') !== '') {
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
|
||||
}
|
||||
if (GETPOST('multicurrency_price_ht') !== '') {
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
|
||||
}
|
||||
if (GETPOST('price_ttc') !== '') {
|
||||
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
|
||||
}
|
||||
if (GETPOST('multicurrency_price_ttc') !== '') {
|
||||
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
|
||||
}
|
||||
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09');
|
||||
if ($prod_entry_mode == 'free') {
|
||||
$idprod = 0;
|
||||
$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
|
||||
$tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0);
|
||||
} else {
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
$qty = price2num(GETPOST('qty'.$predef), 'MS', 2);
|
||||
$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
|
||||
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 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);
|
||||
@ -2050,8 +2067,8 @@ if (empty($reshook)) {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) { // Unit price can be 0 but not ''
|
||||
if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) {
|
||||
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && (($price_ht_devise < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht_devise == '') && $price_ttc === '' && $price_ttc_devise === '' && $object->type != Facture::TYPE_CREDIT_NOTE) { // Unit price can be 0 but not ''
|
||||
if (($price_ht < 0 || $price_ttc < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) {
|
||||
$langs->load("errors");
|
||||
if ($object->type == $object::TYPE_DEPOSIT) {
|
||||
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
|
||||
@ -2131,19 +2148,22 @@ if (empty($reshook)) {
|
||||
$price_min = $datapriceofproduct['price_min'];
|
||||
$price_min_ttc = $datapriceofproduct['price_min_ttc'];
|
||||
$price_base_type = $datapriceofproduct['price_base_type'];
|
||||
|
||||
$tva_tx = $datapriceofproduct['tva_tx'];
|
||||
$tva_npr = $datapriceofproduct['tva_npr'];
|
||||
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
// if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ?
|
||||
// Set unit price to use
|
||||
if (!empty($price_ht) || $price_ht === '0') {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
} elseif (!empty($price_ttc) || $price_ttc === '0') {
|
||||
$pu_ttc = price2num($price_ttc, 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} elseif ($tmpvat != $tmpprodvat) {
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
// Is this still used ?
|
||||
if ($price_base_type != 'HT') {
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} else {
|
||||
@ -2231,7 +2251,7 @@ if (empty($reshook)) {
|
||||
$fk_unit = $prod->fk_unit;
|
||||
} else {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
|
||||
$pu_ttc = price2num($price_ttc, 'MU');
|
||||
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
|
||||
$tva_tx = str_replace('*', '', $tva_tx);
|
||||
if (empty($tva_tx)) {
|
||||
@ -2243,6 +2263,10 @@ if (empty($reshook)) {
|
||||
$fk_unit = GETPOST('units', 'alpha');
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
$pu_ttc_devise = price2num($price_ttc_devise, 'MU');
|
||||
|
||||
if ($pu_ttc && !$pu_ht) {
|
||||
$price_base_type = 'TTC';
|
||||
}
|
||||
}
|
||||
|
||||
// Margin
|
||||
@ -2381,12 +2405,14 @@ if (empty($reshook)) {
|
||||
$description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml') ? GETPOST('product_desc', 'restricthtml') : GETPOST('desc', 'restricthtml'));
|
||||
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
|
||||
$pu_ht = price2num(GETPOST('price_ht'), '', 2);
|
||||
$pu_ttc = price2num(GETPOST('price_ttc'), '', 2);
|
||||
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
|
||||
//$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
|
||||
|
||||
$qty = GETPOST('qty');
|
||||
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
|
||||
$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
|
||||
|
||||
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
@ -2495,8 +2521,8 @@ if (empty($reshook)) {
|
||||
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ((empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) { // Unit price can be 0 but not ''
|
||||
if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) {
|
||||
if (empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && (($pu_ht_devise < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht_devise == '') && $pu_ttc === '' && $pu_ttc_devise === '' && $object->type != Facture::TYPE_CREDIT_NOTE) { // Unit price can be 0 but not ''
|
||||
if (($pu_ht < 0 || $pu_ttc < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) {
|
||||
$langs->load("errors");
|
||||
if ($object->type == $object::TYPE_DEPOSIT) {
|
||||
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
|
||||
@ -2524,10 +2550,17 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
$price_base_type = 'HT';
|
||||
$pu = $pu_ht;
|
||||
if (empty($pu) && ! empty($pu_ttc)) {
|
||||
$pu = $pu_ttc;
|
||||
$price_base_type = 'TTC';
|
||||
}
|
||||
|
||||
$result = $object->updateline(
|
||||
GETPOST('lineid', 'int'),
|
||||
$description,
|
||||
$pu_ht,
|
||||
$pu,
|
||||
$qty,
|
||||
$remise_percent,
|
||||
$date_start,
|
||||
@ -2535,7 +2568,7 @@ if (empty($reshook)) {
|
||||
$vat_rate,
|
||||
$localtax1_rate,
|
||||
$localtax2_rate,
|
||||
'HT',
|
||||
$price_base_type,
|
||||
$info_bits,
|
||||
$type,
|
||||
GETPOST('fk_parent_line', 'int'),
|
||||
@ -5318,10 +5351,15 @@ if ($action == 'create') {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
|
||||
}
|
||||
|
||||
// Lines
|
||||
// Get object lines
|
||||
$result = $object->getLinesArray();
|
||||
|
||||
// Show global modifiers
|
||||
// Add products/services form
|
||||
//$forceall = 1;
|
||||
global $inputalsopricewithtax;
|
||||
$inputalsopricewithtax = 1;
|
||||
|
||||
// Show global modifiers for situation invoices
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION)) {
|
||||
if ($object->situation_cycle_ref && $object->statut == 0) {
|
||||
print '<!-- Area to change globally the situation percent -->'."\n";
|
||||
@ -5363,7 +5401,7 @@ if ($action == 'create') {
|
||||
}
|
||||
}
|
||||
|
||||
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
|
||||
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">
|
||||
<input type="hidden" name="token" value="' . newToken().'">
|
||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
|
||||
<input type="hidden" name="mode" value="">
|
||||
|
||||
@ -396,11 +396,28 @@ 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);
|
||||
|
||||
$price_ht = '';
|
||||
$price_ht_devise = '';
|
||||
$price_ttc = '';
|
||||
$price_ttc_devise = '';
|
||||
|
||||
if (GETPOST('price_ht') !== '') {
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
|
||||
}
|
||||
if (GETPOST('multicurrency_price_ht') !== '') {
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
|
||||
}
|
||||
if (GETPOST('price_ttc') !== '') {
|
||||
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
|
||||
}
|
||||
if (GETPOST('multicurrency_price_ttc') !== '') {
|
||||
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
|
||||
}
|
||||
|
||||
if (GETPOST('prod_entry_mode', 'alpha') == 'free') {
|
||||
$idprod = 0;
|
||||
$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
|
||||
$tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0);
|
||||
} else {
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$tva_tx = '';
|
||||
@ -408,6 +425,9 @@ if (empty($reshook)) {
|
||||
|
||||
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
|
||||
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0);
|
||||
if (empty($remise_percent)) {
|
||||
$remise_percent = 0;
|
||||
}
|
||||
|
||||
if ($qty == '') {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")), null, 'errors');
|
||||
@ -460,6 +480,7 @@ if (empty($reshook)) {
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$price_min = $prod->price_min;
|
||||
$price_min_ttc = $prod->price_min_ttc;
|
||||
$price_base_type = $prod->price_base_type;
|
||||
|
||||
// On defini prix unitaire
|
||||
@ -467,8 +488,10 @@ if (empty($reshook)) {
|
||||
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||
$price_min_ttc = $prod->multiprices_min_ttc[$object->thirdparty->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
// If price per customer
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
|
||||
|
||||
$prodcustprice = new Productcustomerprice($db);
|
||||
@ -478,10 +501,12 @@ if (empty($reshook)) {
|
||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||
if ($result) {
|
||||
if (count($prodcustprice->lines) > 0) {
|
||||
$pu_ht = price($prodcustprice->lines [0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
|
||||
$price_base_type = $prodcustprice->lines [0]->price_base_type;
|
||||
$tva_tx = $prodcustprice->lines [0]->tva_tx;
|
||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||
$price_min = price($prodcustprice->lines[0]->price_min);
|
||||
$price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc);
|
||||
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
||||
$tva_tx = $prodcustprice->lines[0]->tva_tx;
|
||||
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
|
||||
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
||||
}
|
||||
@ -496,9 +521,15 @@ if (empty($reshook)) {
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
if ($tmpvat != $tmpprodvat) {
|
||||
// Set unit price to use
|
||||
if (!empty($price_ht) || $price_ht === '0') {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
} elseif (!empty($price_ttc) || $price_ttc === '0') {
|
||||
$pu_ttc = price2num($price_ttc, 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} elseif ($tmpvat != $tmpprodvat) {
|
||||
// Is this still used ?
|
||||
if ($price_base_type != 'HT') {
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} else {
|
||||
@ -521,12 +552,22 @@ if (empty($reshook)) {
|
||||
|
||||
$fk_unit = $prod->fk_unit;
|
||||
} else {
|
||||
$pu_ht = GETPOST('price_ht');
|
||||
$price_base_type = 'HT';
|
||||
$tva_tx = GETPOST('tva_tx') ?str_replace('*', '', GETPOST('tva_tx')) : 0; // tva_tx field may be disabled, so we use vat rate 0
|
||||
$tva_npr = preg_match('/\*/', GETPOST('tva_tx')) ? 1 : 0;
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($price_ttc, 'MU');
|
||||
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
|
||||
if (empty($tva_tx)) {
|
||||
$tva_npr = 0;
|
||||
}
|
||||
$tva_tx = str_replace('*', '', $tva_tx);
|
||||
$desc = $product_desc;
|
||||
$fk_unit = GETPOST('units', 'alpha');
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
$pu_ttc_devise = price2num($price_ttc_devise, 'MU');
|
||||
|
||||
$price_base_type = 'HT';
|
||||
if ($pu_ttc && !$pu_ht) {
|
||||
$price_base_type = 'TTC';
|
||||
}
|
||||
}
|
||||
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
|
||||
@ -1427,6 +1468,11 @@ if ($action == 'create') {
|
||||
* Lines of contracts
|
||||
*/
|
||||
|
||||
// Add products/services form
|
||||
//$forceall = 1;
|
||||
global $inputalsopricewithtax;
|
||||
$inputalsopricewithtax = 1;
|
||||
|
||||
$productstatic = new Product($db);
|
||||
|
||||
$usemargins = 0;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
@ -325,8 +325,8 @@ $coldisplay++;
|
||||
|
||||
<!-- colspan for this td because it replace total_ht+3 td for buttons+... -->
|
||||
<td class="center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay += $colspan; ?>
|
||||
<input type="submit" class="button buttongen marginbottomonly button-save" id="savelinebutton marginbottomonly" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
|
||||
<input type="submit" class="button buttongen marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
|
||||
<input type="submit" class="reposition button buttongen marginbottomonly button-save" id="savelinebutton marginbottomonly" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
|
||||
<input type="submit" class="reposition button buttongen marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
@ -17,7 +18,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file workstation_agenda.php
|
||||
* \file htdocs/workstation/workstation_agenda.php
|
||||
* \ingroup workstation
|
||||
* \brief Tab of events on Workstation
|
||||
*/
|
||||
@ -32,12 +33,12 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php
|
||||
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("workstation", "other"));
|
||||
$langs->loadLangs(array('workstation', 'other'));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
@ -49,6 +50,7 @@ if (GETPOST('actioncode', 'array')) {
|
||||
} else {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||
}
|
||||
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -73,6 +75,7 @@ $object = new Workstation($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->workstation->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('workstationagenda', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -16,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file workstation_card.php
|
||||
* \file htdocs/workstation/workstation_card.php
|
||||
* \ingroup workstation
|
||||
* \brief Page to create/edit/view workstation
|
||||
*/
|
||||
@ -24,32 +25,33 @@
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstationusergroup.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("workstation", "other"));
|
||||
$langs->loadLangs(array('workstation', 'other'));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'workstationcard'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'workstationcard'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
||||
|
||||
$groups = GETPOST('groups', 'array:int');
|
||||
$groups = GETPOST('groups', 'array:int');
|
||||
$resources = GETPOST('resources', 'array:int');
|
||||
//$lineid = GETPOST('lineid', 'int');
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new Workstation($db);
|
||||
|
||||
//$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->workstation->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('workstationcard', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
@ -142,7 +144,6 @@ if (empty($reshook)) {
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
@ -17,22 +18,22 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file workstation_document.php
|
||||
* \file htdocs/workstation/workstation_document.php
|
||||
* \ingroup workstation
|
||||
* \brief Tab for documents linked to Workstation
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.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/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("workstation", "companies", "other", "mails"));
|
||||
$langs->loadLangs(array('companies', 'mails', 'other', 'workstation'));
|
||||
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
@ -64,6 +65,7 @@ $object = new Workstation($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->workstation->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('workstationdocument', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
@ -17,7 +18,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file workstation_list.php
|
||||
* \file htdocs/workstation/workstation_list.php
|
||||
* \ingroup workstation
|
||||
* \brief List page for workstation
|
||||
*/
|
||||
@ -25,24 +26,24 @@
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("workstation", "other"));
|
||||
$langs->loadLangs(array('workstation', 'other'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'workstationlist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$mode = GETPOST('mode', 'aZ');
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'workstationlist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$mode = GETPOST('mode', 'aZ');
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
@ -63,7 +64,7 @@ $pagenext = $page + 1;
|
||||
$object = new Workstation($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->workstation->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('workstationlist')); // Note that conf->hooks_modules contains array
|
||||
$hookmanager->initHooks(array('workstationlist')); // Note that conf->hooks_modules contains array
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
@ -17,7 +18,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file workstation_note.php
|
||||
* \file htdocs/workstation/workstation_note.php
|
||||
* \ingroup workstation
|
||||
* \brief Tab for notes on Workstation
|
||||
*/
|
||||
@ -29,12 +30,12 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("workstation", "companies"));
|
||||
$langs->loadLangs(array('workstation', 'companies'));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
@ -42,18 +43,19 @@ $backtopage = GETPOST('backtopage', 'alpha');
|
||||
$object = new Workstation($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->workstation->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('workstationnote', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
$hookmanager->initHooks(array('workstationnote', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->workstation->multidir_output[$object->entity]."/".$object->id;
|
||||
}
|
||||
|
||||
$permissionnote = $user->rights->workstation->workstation->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissionnote = $user->rights->workstation->workstation->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check
|
||||
$isdraft = 0;
|
||||
@ -63,7 +65,8 @@ restrictedArea($user, $object->element, $object->id, $object->table_element, 'wo
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -16,9 +16,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/modulebuilder/template/lib/mymodule_myobject.lib.php
|
||||
* \ingroup mymodule
|
||||
* \brief Library files with common functions for MyObject
|
||||
* \file htdocs/zapier/lib/zapier_hook.lib.php
|
||||
* \ingroup zapier
|
||||
* \brief Library files with common functions for Zapier
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -27,6 +27,7 @@
|
||||
* @param MyObject $object MyObject
|
||||
* @return array Array of tabs
|
||||
*/
|
||||
|
||||
function myobjectPrepareHead($object)
|
||||
{
|
||||
global $db, $langs, $conf;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user