|
@@ -103,14 +103,14 @@ $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0);
|
|
|
$selectedLines = GETPOST('toselect', 'array');
|
|
|
|
|
|
// PDF
|
|
|
-$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
|
|
-$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
|
|
-$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
|
|
+$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0));
|
|
|
+$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0));
|
|
|
+$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0));
|
|
|
|
|
|
// Number of lines for predefined product/service choices
|
|
|
$NBLINES = 4;
|
|
|
|
|
|
-$usehm = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE : 0);
|
|
|
+$usehm = (getDolGlobalString('MAIN_USE_HOURMIN_IN_DATE_RANGE') ? $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE : 0);
|
|
|
|
|
|
$object = new Facture($db);
|
|
|
$extrafields = new ExtraFields($db);
|
|
@@ -121,7 +121,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|
|
// Load object
|
|
|
if ($id > 0 || !empty($ref)) {
|
|
|
if ($action != 'add') {
|
|
|
- if (empty($conf->global->INVOICE_USE_SITUATION)) {
|
|
|
+ if (!getDolGlobalString('INVOICE_USE_SITUATION')) {
|
|
|
$fetch_situation = false;
|
|
|
} else {
|
|
|
$fetch_situation = true;
|
|
@@ -144,15 +144,15 @@ $usercandelete = $user->hasRight("facture", "supprimer");
|
|
|
$usercancreatecontract = $user->hasRight("contrat", "creer");
|
|
|
|
|
|
// Advanced Permissions
|
|
|
-$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->validate)));
|
|
|
-$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->send)));
|
|
|
-$usercanreopen = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->reopen)));
|
|
|
-if (!empty($conf->global->INVOICE_DISALLOW_REOPEN)) {
|
|
|
+$usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->facture->invoice_advance->validate)));
|
|
|
+$usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->facture->invoice_advance->send)));
|
|
|
+$usercanreopen = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->facture->invoice_advance->reopen)));
|
|
|
+if (getDolGlobalString('INVOICE_DISALLOW_REOPEN')) {
|
|
|
$usercanreopen = false;
|
|
|
}
|
|
|
-$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate)));
|
|
|
+$usercanunvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->facture->invoice_advance->unvalidate)));
|
|
|
|
|
|
-$usermustrespectpricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
|
|
|
+$usermustrespectpricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty($user->rights->produit->ignore_price_min_advance)) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS'));
|
|
|
$usercancreatemargin = (!empty($user->rights->margins->creer) ? $user->rights->margins->creer : 0);
|
|
|
$usercanreadallmargin = (!empty($user->rights->margins->liretous) ? $user->rights->margins->liretous : 0);
|
|
|
$usercancreatewithdrarequest = (!empty($user->rights->prelevement->bons->creer) ? $user->rights->prelevement->bons->creer : 0);
|
|
@@ -164,7 +164,7 @@ $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatede
|
|
|
|
|
|
// retained warranty invoice available type
|
|
|
$retainedWarrantyInvoiceAvailableType = array();
|
|
|
-if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
|
|
+if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')) {
|
|
|
$retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY);
|
|
|
}
|
|
|
|
|
@@ -252,7 +252,7 @@ if (empty($reshook)) {
|
|
|
$idwarehouse = GETPOST('idwarehouse');
|
|
|
|
|
|
$qualified_for_stock_change = 0;
|
|
|
- if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
|
|
+ if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
|
|
} else {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
|
@@ -294,7 +294,7 @@ if (empty($reshook)) {
|
|
|
$outputlangs->setDefaultLang($newlang);
|
|
|
$outputlangs->load('products');
|
|
|
}
|
|
|
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
|
+ if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
|
|
$ret = $object->fetch($id); // Reload to get new records
|
|
|
$result = $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
|
}
|
|
@@ -315,7 +315,7 @@ if (empty($reshook)) {
|
|
|
// Validation
|
|
|
$object->fetch($id);
|
|
|
|
|
|
- if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
|
|
|
+ if (getDolGlobalString('INVOICE_CHECK_POSTERIOR_DATE')) {
|
|
|
$last_of_type = $object->willBeLastOfSameType(true);
|
|
|
if (empty($object->date_validation) && !$last_of_type[0]) {
|
|
|
setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors');
|
|
@@ -335,7 +335,7 @@ if (empty($reshook)) {
|
|
|
// Note that amount excluding tax can be negative because you can have a invoice of 100 with vat of 20 that
|
|
|
// consumes a credit note of 100 with vat 0 (total with tax is 0 but without tax is -20).
|
|
|
// For some cases, credit notes can have a vat of 0 (for example when selling goods in France).
|
|
|
- if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ttc < 0) {
|
|
|
+ if (!getDolGlobalString('FACTURE_ENABLE_NEGATIVE') && $object->total_ttc < 0) {
|
|
|
setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors');
|
|
|
$action = '';
|
|
|
}
|
|
@@ -365,7 +365,7 @@ if (empty($reshook)) {
|
|
|
$tmp_total_ht = price2num($array_of_total_ht_per_vat_rate[$vatrate]);
|
|
|
$tmp_total_ht_devise = price2num($array_of_total_ht_devise_per_vat_rate[$vatrate]);
|
|
|
|
|
|
- if (($tmp_total_ht < 0 || $tmp_total_ht_devise < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) {
|
|
|
+ if (($tmp_total_ht < 0 || $tmp_total_ht_devise < 0) && !getDolGlobalString('FACTURE_ENABLE_NEGATIVE_LINES')) {
|
|
|
if ($object->type == $object::TYPE_DEPOSIT) {
|
|
|
$langs->load("errors");
|
|
|
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
|
|
@@ -440,8 +440,8 @@ if (empty($reshook)) {
|
|
|
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate&token='.newToken());
|
|
|
exit;
|
|
|
}
|
|
|
- if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
- if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) {
|
|
|
+ if ($newdate > (dol_now('tzuserrel') + (!getDolGlobalString('INVOICE_MAX_FUTURE_DELAY') ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
+ if (!getDolGlobalString('INVOICE_MAX_FUTURE_DELAY')) {
|
|
|
setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
|
|
|
} else {
|
|
|
setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
|
|
@@ -528,7 +528,7 @@ if (empty($reshook)) {
|
|
|
dol_print_error($db, $object->error);
|
|
|
} else {
|
|
|
// Define output language
|
|
|
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
|
+ if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
|
|
$outputlangs = $langs;
|
|
|
$newlang = '';
|
|
|
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
|
@@ -612,7 +612,7 @@ if (empty($reshook)) {
|
|
|
$db->rollback();
|
|
|
}
|
|
|
|
|
|
- if (empty($error) && empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
|
+ if (empty($error) && !getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
|
|
$outputlangs = $langs;
|
|
|
$newlang = '';
|
|
|
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
|
@@ -647,9 +647,9 @@ if (empty($reshook)) {
|
|
|
$object->fetch_thirdparty();
|
|
|
|
|
|
// Check for warehouse
|
|
|
- if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
|
|
+ if ($object->type != Facture::TYPE_DEPOSIT && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) {
|
|
|
$qualified_for_stock_change = 0;
|
|
|
- if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
|
|
+ if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
|
|
} else {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
|
@@ -668,7 +668,7 @@ if (empty($reshook)) {
|
|
|
$result = $object->validate($user, '', $idwarehouse);
|
|
|
if ($result >= 0) {
|
|
|
// Define output language
|
|
|
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
|
+ if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
|
|
$outputlangs = $langs;
|
|
|
$newlang = '';
|
|
|
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
|
@@ -707,9 +707,9 @@ if (empty($reshook)) {
|
|
|
$object->fetch_thirdparty();
|
|
|
|
|
|
// Check parameters
|
|
|
- if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
|
|
+ if ($object->type != Facture::TYPE_DEPOSIT && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) {
|
|
|
$qualified_for_stock_change = 0;
|
|
|
- if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
|
|
+ if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
|
|
} else {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
|
@@ -752,14 +752,14 @@ if (empty($reshook)) {
|
|
|
|
|
|
// We check if no payment has been made
|
|
|
if ($ventilExportCompta == 0) {
|
|
|
- if (!empty($conf->global->INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE) || ($resteapayer == $object->total_ttc && empty($object->paye))) {
|
|
|
+ if (getDolGlobalString('INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE') || ($resteapayer == $object->total_ttc && empty($object->paye))) {
|
|
|
$result = $object->setDraft($user, $idwarehouse);
|
|
|
if ($result < 0) {
|
|
|
setEventMessages($object->error, $object->errors, 'errors');
|
|
|
}
|
|
|
|
|
|
// Define output language
|
|
|
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
|
+ if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
|
|
$outputlangs = $langs;
|
|
|
$newlang = '';
|
|
|
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
|
@@ -855,7 +855,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
|
|
|
// If some payments were already done, we change the amount to pay using same prorate
|
|
|
- if (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) && $object->type == Facture::TYPE_CREDIT_NOTE) {
|
|
|
+ if (getDolGlobalString('INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED') && $object->type == Facture::TYPE_CREDIT_NOTE) {
|
|
|
$alreadypaid = $object->getSommePaiement(); // This can be not 0 if we allow to create credit to reuse from credit notes partially refunded.
|
|
|
if ($alreadypaid && abs($alreadypaid) < abs($object->total_ttc)) {
|
|
|
$ratio = abs(($object->total_ttc - $alreadypaid) / $object->total_ttc);
|
|
@@ -1022,7 +1022,7 @@ if (empty($reshook)) {
|
|
|
$error++;
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
|
|
$action = 'create';
|
|
|
- } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (!getDolGlobalString('INVOICE_MAX_FUTURE_DELAY') ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
$error++;
|
|
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
|
|
$action = 'create';
|
|
@@ -1071,7 +1071,7 @@ if (empty($reshook)) {
|
|
|
// Credit note invoice
|
|
|
if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) {
|
|
|
$sourceinvoice = GETPOST('fac_avoir', 'int');
|
|
|
- if (!($sourceinvoice > 0) && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) {
|
|
|
+ if (!($sourceinvoice > 0) && !getDolGlobalString('INVOICE_CREDIT_NOTE_STANDALONE')) {
|
|
|
$error++;
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors');
|
|
|
$action = 'create';
|
|
@@ -1081,7 +1081,7 @@ if (empty($reshook)) {
|
|
|
$error++;
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
|
|
$action = 'create';
|
|
|
- } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (!getDolGlobalString('INVOICE_MAX_FUTURE_DELAY') ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
$error++;
|
|
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
|
|
$action = 'create';
|
|
@@ -1305,7 +1305,7 @@ if (empty($reshook)) {
|
|
|
$error++;
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
|
|
$action = 'create';
|
|
|
- } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (!getDolGlobalString('INVOICE_MAX_FUTURE_DELAY') ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
$error++;
|
|
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
|
|
$action = 'create';
|
|
@@ -1365,7 +1365,7 @@ if (empty($reshook)) {
|
|
|
$error++;
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
|
|
$action = 'create';
|
|
|
- } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (!getDolGlobalString('INVOICE_MAX_FUTURE_DELAY') ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
$error++;
|
|
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
|
|
$action = 'create';
|
|
@@ -1516,7 +1516,7 @@ if (empty($reshook)) {
|
|
|
if (GETPOST('type') == Facture::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable'))) {
|
|
|
// Define the array $amountdeposit
|
|
|
$amountdeposit = array();
|
|
|
- if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)) {
|
|
|
+ if (getDolGlobalString('MAIN_DEPOSIT_MULTI_TVA')) {
|
|
|
if ($typeamount == 'amount') {
|
|
|
$amount = $valuedeposit;
|
|
|
} else {
|
|
@@ -1597,7 +1597,7 @@ if (empty($reshook)) {
|
|
|
$tva, // vat rate
|
|
|
0, // localtax1_tx
|
|
|
0, // localtax2_tx
|
|
|
- (empty($conf->global->INVOICE_PRODUCTID_DEPOSIT) ? 0 : $conf->global->INVOICE_PRODUCTID_DEPOSIT), // fk_product
|
|
|
+ (!getDolGlobalString('INVOICE_PRODUCTID_DEPOSIT') ? 0 : $conf->global->INVOICE_PRODUCTID_DEPOSIT), // fk_product
|
|
|
0, // remise_percent
|
|
|
0, // date_start
|
|
|
0, // date_end
|
|
@@ -1627,7 +1627,7 @@ if (empty($reshook)) {
|
|
|
|
|
|
$diff = $object->total_ttc - $amount_ttc_diff;
|
|
|
|
|
|
- if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA) && $diff != 0) {
|
|
|
+ if (getDolGlobalString('MAIN_DEPOSIT_MULTI_TVA') && $diff != 0) {
|
|
|
$object->fetch_lines();
|
|
|
$subprice_diff = $object->lines[0]->subprice - $diff / (1 + $object->lines[0]->tva_tx / 100);
|
|
|
$object->updateline($object->lines[0]->id, $object->lines[0]->desc, $subprice_diff, $object->lines[0]->qty, $object->lines[0]->remise_percent, $object->lines[0]->date_start, $object->lines[0]->date_end, $object->lines[0]->tva_tx, 0, 0, 'HT', $object->lines[0]->info_bits, $object->lines[0]->product_type, 0, 0, 0, $object->lines[0]->pa_ht, $object->lines[0]->label, 0, array(), 100);
|
|
@@ -1688,7 +1688,7 @@ if (empty($reshook)) {
|
|
|
$lines[$i]->situation_percent = 0;
|
|
|
}
|
|
|
|
|
|
- if ($lines[$i]->subprice < 0 && empty($conf->global->INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN)) {
|
|
|
+ if ($lines[$i]->subprice < 0 && !getDolGlobalString('INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
|
|
|
// Negative line, we create a discount line
|
|
|
if (empty($desc)) {
|
|
|
$desc = $label ? $label : $langs->trans('Discount');
|
|
@@ -1882,7 +1882,7 @@ if (empty($reshook)) {
|
|
|
$error++;
|
|
|
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
|
|
|
setEventMessages($mesg, null, 'errors');
|
|
|
- } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (!getDolGlobalString('INVOICE_MAX_FUTURE_DELAY') ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
|
|
$error++;
|
|
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
|
|
$action = 'create';
|
|
@@ -1907,7 +1907,7 @@ if (empty($reshook)) {
|
|
|
$object->origin_id = $originid;
|
|
|
|
|
|
// retained warranty
|
|
|
- if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
|
|
+ if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')) {
|
|
|
$retained_warranty = GETPOST('retained_warranty', 'int');
|
|
|
if (price2num($retained_warranty) > 0) {
|
|
|
$object->retained_warranty = price2num($retained_warranty);
|
|
@@ -1997,7 +1997,7 @@ if (empty($reshook)) {
|
|
|
$db->commit();
|
|
|
|
|
|
// Define output language
|
|
|
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE) && count($object->lines)) {
|
|
|
+ if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE') && count($object->lines)) {
|
|
|
$outputlangs = $langs;
|
|
|
$newlang = '';
|
|
|
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
|
@@ -2079,7 +2079,7 @@ if (empty($reshook)) {
|
|
|
} else {
|
|
|
$idprod = GETPOST('idprod', 'int');
|
|
|
|
|
|
- if (!empty($conf->global->MAIN_DISABLE_FREE_LINES) && $idprod <= 0) {
|
|
|
+ if (getDolGlobalString('MAIN_DISABLE_FREE_LINES') && $idprod <= 0) {
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProductOrService")), null, 'errors');
|
|
|
$error++;
|
|
|
}
|
|
@@ -2118,8 +2118,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 < 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)) {
|
|
|
+ if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (($price_ht < 0 && !getDolGlobalString('FACTURE_ENABLE_NEGATIVE_LINES')) || $price_ht == '') && (($price_ht_devise < 0 && !getDolGlobalString('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) && !getDolGlobalString('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.
|
|
@@ -2225,7 +2225,7 @@ if (empty($reshook)) {
|
|
|
$desc = '';
|
|
|
|
|
|
// Define output language
|
|
|
- if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
|
|
+ if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
|
|
|
$outputlangs = $langs;
|
|
|
$newlang = '';
|
|
|
if (empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
|
@@ -2246,21 +2246,21 @@ 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 ($product_desc==$desc && getDolGlobalString('PRODUIT_AUTOFILL_DESC')) {
|
|
|
$product_desc='';
|
|
|
}
|
|
|
|
|
|
- if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) {
|
|
|
+ if (!empty($product_desc) && getDolGlobalString('MAIN_NO_CONCAT_DESCRIPTION')) {
|
|
|
$desc = $product_desc;
|
|
|
} else {
|
|
|
- $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
|
|
|
+ $desc = dol_concatdesc($desc, $product_desc, '', getDolGlobalString('MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION'));
|
|
|
}
|
|
|
|
|
|
// Add custom code and origin country into description
|
|
|
- if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (!empty($prod->customcode) || !empty($prod->country_code))) {
|
|
|
+ if (!getDolGlobalString('MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE') && (!empty($prod->customcode) || !empty($prod->country_code))) {
|
|
|
$tmptxt = '(';
|
|
|
// Define output language
|
|
|
- if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
|
|
+ if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
|
|
|
$outputlangs = $langs;
|
|
|
$newlang = '';
|
|
|
if (empty($newlang) && GETPOST('lang_id', 'alpha')) {
|
|
@@ -2394,7 +2394,7 @@ if (empty($reshook)) {
|
|
|
|
|
|
if (!$error) {
|
|
|
// Add batchinfo if the detail_batch array is defined
|
|
|
- if (isModEnabled('productbatch') && !empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) {
|
|
|
+ if (isModEnabled('productbatch') && !empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && getDolGlobalString('INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS')) {
|
|
|
$langs->load('productbatch');
|
|
|
foreach ($lines[$i]->detail_batch as $batchline) {
|
|
|
$desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' ';
|
|
@@ -2406,7 +2406,7 @@ if (empty($reshook)) {
|
|
|
|
|
|
if ($result > 0) {
|
|
|
// Define output language and generate document
|
|
|
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
|
+ if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
|
|
$outputlangs = $langs;
|
|
|
$newlang = '';
|
|
|
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
|
@@ -2585,11 +2585,11 @@ if (empty($reshook)) {
|
|
|
$type = $product->type;
|
|
|
|
|
|
$price_min = $product->price_min;
|
|
|
- if ((!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && !empty($object->thirdparty->price_level)) {
|
|
|
+ if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !empty($object->thirdparty->price_level)) {
|
|
|
$price_min = $product->multiprices_min[$object->thirdparty->price_level];
|
|
|
}
|
|
|
$price_min_ttc = $product->price_min_ttc;
|
|
|
- if ((!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && !empty($object->thirdparty->price_level)) {
|
|
|
+ if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !empty($object->thirdparty->price_level)) {
|
|
|
$price_min_ttc = $product->multiprices_min_ttc[$object->thirdparty->price_level];
|
|
|
}
|
|
|
|
|
@@ -2624,8 +2624,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 < 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)) {
|
|
|
+ if (empty($productid) && (($pu_ht < 0 && !getDolGlobalString('FACTURE_ENABLE_NEGATIVE_LINES')) || $pu_ht == '') && (($pu_ht_devise < 0 && !getDolGlobalString('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) && !getDolGlobalString('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.
|
|
@@ -2687,7 +2687,7 @@ if (empty($reshook)) {
|
|
|
);
|
|
|
|
|
|
if ($result >= 0) {
|
|
|
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
|
+ if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
|
|
// Define output language
|
|
|
$outputlangs = $langs;
|
|
|
$newlang = '';
|
|
@@ -2983,7 +2983,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $usercancreate) {
|
|
|
+ if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB') && $usercancreate) {
|
|
|
if ($action == 'addcontact') {
|
|
|
$result = $object->fetch($id);
|
|
|
|
|
@@ -3103,7 +3103,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
if (!$dateinvoice) {
|
|
|
// Do not set 0 here (0 for a date is 1970)
|
|
|
- $dateinvoice = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $dateinvoice);
|
|
|
+ $dateinvoice = (empty($dateinvoice) ? (!getDolGlobalString('MAIN_AUTOFILL_DATE') ?-1 : '') : $dateinvoice);
|
|
|
}
|
|
|
} else {
|
|
|
// For compatibility
|
|
@@ -3139,7 +3139,7 @@ if ($action == 'create') {
|
|
|
$soc = $objectsrc->thirdparty;
|
|
|
}
|
|
|
|
|
|
- $dateinvoice = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $dateinvoice);
|
|
|
+ $dateinvoice = (empty($dateinvoice) ? (!getDolGlobalString('MAIN_AUTOFILL_DATE') ?-1 : '') : $dateinvoice);
|
|
|
|
|
|
if ($element == 'expedition') {
|
|
|
$ref_client = (!empty($objectsrc->ref_customer) ? $objectsrc->ref_customer : '');
|
|
@@ -3177,7 +3177,7 @@ if ($action == 'create') {
|
|
|
if (!empty($objectsrc->multicurrency_code)) {
|
|
|
$currency_code = $objectsrc->multicurrency_code;
|
|
|
}
|
|
|
- if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) {
|
|
|
+ if (getDolGlobalString('MULTICURRENCY_USE_ORIGIN_TX') && !empty($objectsrc->multicurrency_tx)) {
|
|
|
$currency_tx = $objectsrc->multicurrency_tx;
|
|
|
}
|
|
|
}
|
|
@@ -3193,7 +3193,7 @@ if ($action == 'create') {
|
|
|
$fk_account = empty($soc->fk_account) ? $fk_account : $soc->fk_account;
|
|
|
//$remise_percent = $soc->remise_percent;
|
|
|
//$remise_absolue = 0;
|
|
|
- $dateinvoice = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $dateinvoice); // Do not set 0 here (0 for a date is 1970)
|
|
|
+ $dateinvoice = (empty($dateinvoice) ? (!getDolGlobalString('MAIN_AUTOFILL_DATE') ?-1 : '') : $dateinvoice); // Do not set 0 here (0 for a date is 1970)
|
|
|
|
|
|
if (isModEnabled('multicurrency') && !empty($soc->multicurrency_code)) {
|
|
|
$currency_code = $soc->multicurrency_code;
|
|
@@ -3233,8 +3233,8 @@ if ($action == 'create') {
|
|
|
if (!empty($soc->id)) {
|
|
|
$absolute_discount = $soc->getAvailableDiscounts();
|
|
|
}
|
|
|
- $note_public = $object->getDefaultCreateValueFor('note_public', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_public : null));
|
|
|
- $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_private : null));
|
|
|
+ $note_public = $object->getDefaultCreateValueFor('note_public', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && getDolGlobalString('FACTURE_REUSE_NOTES_ON_CREATE_FROM')) ? $objectsrc->note_public : null));
|
|
|
+ $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && getDolGlobalString('FACTURE_REUSE_NOTES_ON_CREATE_FROM')) ? $objectsrc->note_private : null));
|
|
|
|
|
|
if (!empty($conf->use_javascript_ajax)) {
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
|
@@ -3247,7 +3247,7 @@ if ($action == 'create') {
|
|
|
$langs->load("admin");
|
|
|
$text = $langs->trans("ToCreateARecurringInvoice");
|
|
|
$text .= ' '.$langs->trans("ToCreateARecurringInvoiceGene", $langs->transnoentitiesnoconv("MenuFinancial"), $langs->transnoentitiesnoconv("BillsCustomers"), $langs->transnoentitiesnoconv("ListOfTemplates"));
|
|
|
- if (empty($conf->global->INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE)) {
|
|
|
+ if (!getDolGlobalString('INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE')) {
|
|
|
$text .= ' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name'));
|
|
|
}
|
|
|
print info_admin($text, 0, 0, 0, 'opacitymedium').'<br>';
|
|
@@ -3317,7 +3317,7 @@ if ($action == 'create') {
|
|
|
$filter = '((s.client:IN:1,2,3) AND (s.status:=:1))';
|
|
|
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
|
|
// Option to reload page to retrieve customer informations.
|
|
|
- if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
|
|
+ if (!getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) {
|
|
|
print '<script>
|
|
|
$(document).ready(function() {
|
|
|
$("#socid").change(function() {
|
|
@@ -3395,7 +3395,7 @@ if ($action == 'create') {
|
|
|
print ajax_combobox("fac_rec");
|
|
|
|
|
|
// Option to reload page to retrieve customer informations. Note, this clear other input
|
|
|
- if (empty($conf->global->RELOAD_PAGE_ON_TEMPLATE_CHANGE_DISABLED)) {
|
|
|
+ if (!getDolGlobalString('RELOAD_PAGE_ON_TEMPLATE_CHANGE_DISABLED')) {
|
|
|
print '<script type="text/javascript">
|
|
|
$(document).ready(function() {
|
|
|
$("#fac_rec").change(function() {
|
|
@@ -3446,7 +3446,7 @@ if ($action == 'create') {
|
|
|
|
|
|
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (!empty($originid)))) {
|
|
|
// Deposit - Down payment
|
|
|
- if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) {
|
|
|
+ if (!getDolGlobalString('INVOICE_DISABLE_DEPOSIT')) {
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
$tmp = '<input type="radio" id="radio_deposit" name="type" value="3"'.(GETPOST('type') == 3 ? ' checked' : '').'> ';
|
|
|
print '<script type="text/javascript">
|
|
@@ -3515,7 +3515,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
if ($socid > 0) {
|
|
|
- if (!empty($conf->global->INVOICE_USE_SITUATION)) {
|
|
|
+ if (getDolGlobalString('INVOICE_USE_SITUATION')) {
|
|
|
// First situation invoice
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
$tmp = '<input id="radio_situation" type="radio" name="type" value="5"'.(GETPOST('type') == 5 ? ' checked' : '').'> ';
|
|
@@ -3547,7 +3547,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
// Replacement
|
|
|
- if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) {
|
|
|
+ if (!getDolGlobalString('INVOICE_DISABLE_REPLACEMENT')) {
|
|
|
// Type de facture
|
|
|
$facids = $facturestatic->list_replacable_invoices($soc->id);
|
|
|
if ($facids < 0) {
|
|
@@ -3599,7 +3599,7 @@ if ($action == 'create') {
|
|
|
print '</div></div>';
|
|
|
}
|
|
|
} else {
|
|
|
- if (!empty($conf->global->INVOICE_USE_SITUATION)) {
|
|
|
+ if (getDolGlobalString('INVOICE_USE_SITUATION')) {
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
$tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
|
|
|
$text = $tmp.'<label>'.$langs->trans("InvoiceSituationAsk").'</label> ';
|
|
@@ -3621,7 +3621,7 @@ if ($action == 'create') {
|
|
|
if (empty($origin)) {
|
|
|
if ($socid > 0) {
|
|
|
// Credit note
|
|
|
- if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) {
|
|
|
+ if (!getDolGlobalString('INVOICE_DISABLE_CREDIT_NOTE')) {
|
|
|
// Show link for credit note
|
|
|
$facids = $facturestatic->list_qualified_avoir_invoices($soc->id);
|
|
|
if ($facids < 0) {
|
|
@@ -3653,7 +3653,7 @@ if ($action == 'create') {
|
|
|
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
$tmp = '<input type="radio" id="radio_creditnote" name="type" value="2"'.(GETPOST('type') == 2 ? ' checked' : '');
|
|
|
- if ((!$optionsav && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) || $invoice_predefined->id > 0) {
|
|
|
+ if ((!$optionsav && !getDolGlobalString('INVOICE_CREDIT_NOTE_STANDALONE')) || $invoice_predefined->id > 0) {
|
|
|
$tmp .= ' disabled';
|
|
|
}
|
|
|
$tmp .= '> ';
|
|
@@ -3703,7 +3703,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
} else {
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
- if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) {
|
|
|
+ if (!getDolGlobalString('INVOICE_CREDIT_NOTE_STANDALONE')) {
|
|
|
$tmp = '<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
|
|
|
} else {
|
|
|
$tmp = '<input type="radio" name="type" id="radio_creditnote" value="2" > ';
|
|
@@ -3727,7 +3727,7 @@ if ($action == 'create') {
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
- if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) { // Hidden conf
|
|
|
+ if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) { // Hidden conf
|
|
|
// Add auto select default document model
|
|
|
$listtType = array(Facture::TYPE_STANDARD, Facture::TYPE_REPLACEMENT, Facture::TYPE_CREDIT_NOTE, Facture::TYPE_DEPOSIT, Facture::TYPE_SITUATION);
|
|
|
$jsListType = '';
|
|
@@ -3790,7 +3790,7 @@ if ($action == 'create') {
|
|
|
print '</td></tr>';
|
|
|
|
|
|
// Date point of tax
|
|
|
- if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
|
|
+ if (getDolGlobalString('INVOICE_POINTOFTAX_DATE')) {
|
|
|
print '<tr><td class="fieldrequired">'.$langs->trans('DatePointOfTax').'</td><td colspan="2">';
|
|
|
print img_picto('', 'action', 'class="pictofixedwidth"');
|
|
|
print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
|
|
@@ -3804,7 +3804,7 @@ if ($action == 'create') {
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
|
|
- if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
|
|
+ if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')) {
|
|
|
$rwStyle = 'display:none;';
|
|
|
if (in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)) {
|
|
|
$rwStyle = '';
|
|
@@ -3898,7 +3898,7 @@ if ($action == 'create') {
|
|
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
if (empty($reshook)) {
|
|
|
- if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_INVOICE) && !empty($soc->id)) {
|
|
|
+ if (getDolGlobalString('THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_INVOICE') && !empty($soc->id)) {
|
|
|
// copy from thirdparty
|
|
|
$tpExtrafields = new ExtraFields($db);
|
|
|
$tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element);
|
|
@@ -3916,7 +3916,7 @@ if ($action == 'create') {
|
|
|
print img_picto('', 'pdf', 'class="pictofixedwidth"');
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
|
|
|
$liste = ModelePDFFactures::liste_modeles($db);
|
|
|
- if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) {
|
|
|
+ if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) {
|
|
|
// Hidden conf
|
|
|
$paramkey = 'FACTURE_ADDON_PDF_'.$object->type;
|
|
|
$preselected = !empty($conf->global->$paramkey) ? $conf->global->$paramkey : $conf->global->FACTURE_ADDON_PDF;
|
|
@@ -3970,7 +3970,7 @@ if ($action == 'create') {
|
|
|
print $form->textwithpicto($langs->trans('NotePublic'), $htmltext);
|
|
|
print '</td>';
|
|
|
print '<td valign="top" colspan="2">';
|
|
|
- $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
|
|
|
+ $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
|
|
|
print $doleditor->Create(1);
|
|
|
|
|
|
// Private note
|
|
@@ -3980,7 +3980,7 @@ if ($action == 'create') {
|
|
|
print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext);
|
|
|
print '</td>';
|
|
|
print '<td valign="top" colspan="2">';
|
|
|
- $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
|
|
|
+ $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
|
|
|
print $doleditor->Create(1);
|
|
|
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
|
|
|
print '</td></tr>';
|
|
@@ -4142,7 +4142,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
$resteapayeraffiche = $resteapayer;
|
|
|
|
|
|
- if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this
|
|
|
+ if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { // Never use this
|
|
|
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
|
|
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
|
|
} else {
|
|
@@ -4187,9 +4187,9 @@ if ($action == 'create') {
|
|
|
$text = $langs->trans('ConfirmDeleteBill', $object->ref);
|
|
|
$formquestion = array();
|
|
|
|
|
|
- if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->statut >= 1) {
|
|
|
+ if ($object->type != Facture::TYPE_DEPOSIT && getDolGlobalString('STOCK_CALCULATE_ON_BILL') && $object->statut >= 1) {
|
|
|
$qualified_for_stock_change = 0;
|
|
|
- if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
|
|
+ if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
|
|
} else {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
|
@@ -4241,7 +4241,7 @@ if ($action == 'create') {
|
|
|
$objectref = substr($object->ref, 1, 4);
|
|
|
if ($objectref == 'PROV') {
|
|
|
$savdate = $object->date;
|
|
|
- if (!empty($conf->global->FAC_FORCE_DATE_VALIDATION)) {
|
|
|
+ if (getDolGlobalString('FAC_FORCE_DATE_VALIDATION')) {
|
|
|
$object->date = dol_now();
|
|
|
$object->date_lim_reglement = $object->calculate_date_lim_reglement();
|
|
|
}
|
|
@@ -4260,9 +4260,9 @@ if ($action == 'create') {
|
|
|
}
|
|
|
$formquestion = array();
|
|
|
|
|
|
- if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
|
|
+ if ($object->type != Facture::TYPE_DEPOSIT && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) {
|
|
|
$qualified_for_stock_change = 0;
|
|
|
- if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
|
|
+ if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
|
|
} else {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
|
@@ -4317,9 +4317,9 @@ if ($action == 'create') {
|
|
|
$text = $langs->trans('ConfirmUnvalidateBill', $object->ref);
|
|
|
$formquestion = array();
|
|
|
|
|
|
- if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
|
|
+ if ($object->type != Facture::TYPE_DEPOSIT && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) {
|
|
|
$qualified_for_stock_change = 0;
|
|
|
- if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
|
|
+ if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
|
|
} else {
|
|
|
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
|
@@ -4353,10 +4353,10 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
// Confirmation of payment classification
|
|
|
- if ($action == 'paid' && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) && $resteapayer == $object->total_ttc))) {
|
|
|
+ if ($action == 'paid' && ($resteapayer <= 0 || (getDolGlobalString('INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID') && $resteapayer == $object->total_ttc))) {
|
|
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', "yes", 1);
|
|
|
}
|
|
|
- if ($action == 'paid' && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) || $resteapayer != $object->total_ttc)) {
|
|
|
+ if ($action == 'paid' && $resteapayer > 0 && (!getDolGlobalString('INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID') || $resteapayer != $object->total_ttc)) {
|
|
|
$close = array();
|
|
|
// Code
|
|
|
$i = 0;
|
|
@@ -4491,7 +4491,7 @@ if ($action == 'create') {
|
|
|
|
|
|
$morehtmlref = '<div class="refidno">';
|
|
|
// Ref invoice
|
|
|
- if ($object->status == $object::STATUS_DRAFT && !$mysoc->isInEEC() && !empty($conf->global->INVOICE_ALLOW_FREE_REF)) {
|
|
|
+ if ($object->status == $object::STATUS_DRAFT && !$mysoc->isInEEC() && getDolGlobalString('INVOICE_ALLOW_FREE_REF')) {
|
|
|
$morehtmlref .= $form->editfieldkey("Ref", 'ref', $object->ref, $object, $usercancreate, 'string', '', 0, 1);
|
|
|
$morehtmlref .= $form->editfieldval("Ref", 'ref', $object->ref, $object, $usercancreate, 'string', '', null, null, '', 1);
|
|
|
$morehtmlref .= '<br>';
|
|
@@ -4501,7 +4501,7 @@ if ($action == 'create') {
|
|
|
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
|
|
|
// Thirdparty
|
|
|
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');
|
|
|
- if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
|
|
|
+ if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) {
|
|
|
$morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
|
|
|
}
|
|
|
// Project
|
|
@@ -4640,7 +4640,7 @@ if ($action == 'create') {
|
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
- if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
|
|
+ if (getDolGlobalString('INVOICE_POINTOFTAX_DATE')) {
|
|
|
// Date invoice point of tax
|
|
|
print '<tr><td>';
|
|
|
print '<table class="nobordernopadding centpercent"><tr><td>';
|
|
@@ -4809,7 +4809,7 @@ if ($action == 'create') {
|
|
|
|
|
|
|
|
|
|
|
|
- if (!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
|
|
+ if (!empty($object->retained_warranty) || getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')) {
|
|
|
$displayWarranty = true;
|
|
|
if (!in_array($object->type, $retainedWarrantyInvoiceAvailableType) && empty($object->retained_warranty)) {
|
|
|
$displayWarranty = false;
|
|
@@ -4924,7 +4924,7 @@ if ($action == 'create') {
|
|
|
print '<table class="border tableforfield centpercent">';
|
|
|
|
|
|
$sign = 1;
|
|
|
- if (!empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE_SCREEN) && $object->type == $object::TYPE_CREDIT_NOTE) {
|
|
|
+ if (getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE_SCREEN') && $object->type == $object::TYPE_CREDIT_NOTE) {
|
|
|
$sign = -1; // We invert sign for output
|
|
|
}
|
|
|
print '<tr>';
|
|
@@ -5060,7 +5060,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
// List of previous situation invoices
|
|
|
- if (($object->situation_cycle_ref > 0) && !empty($conf->global->INVOICE_USE_SITUATION)) {
|
|
|
+ if (($object->situation_cycle_ref > 0) && getDolGlobalString('INVOICE_USE_SITUATION')) {
|
|
|
print '<!-- List of situation invoices -->';
|
|
|
print '<table class="noborder situationstable" width="100%">';
|
|
|
|
|
@@ -5507,13 +5507,13 @@ if ($action == 'create') {
|
|
|
|
|
|
print '<div class="clearboth"></div><br><br>';
|
|
|
|
|
|
- if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
|
|
+ if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
|
|
|
$blocname = 'contacts';
|
|
|
$title = $langs->trans('ContactsAddresses');
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
|
|
|
}
|
|
|
|
|
|
- if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
|
|
|
+ if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) {
|
|
|
$blocname = 'notes';
|
|
|
$title = $langs->trans('Notes');
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
|
|
@@ -5528,7 +5528,7 @@ if ($action == 'create') {
|
|
|
$inputalsopricewithtax = 1;
|
|
|
|
|
|
// Show global modifiers for situation invoices
|
|
|
- if (!empty($conf->global->INVOICE_USE_SITUATION)) {
|
|
|
+ if (getDolGlobalString('INVOICE_USE_SITUATION')) {
|
|
|
if ($object->situation_cycle_ref && $object->statut == 0) {
|
|
|
print '<!-- Area to change globally the situation percent -->'."\n";
|
|
|
print '<div class="div-table-responsive">';
|
|
@@ -5544,7 +5544,7 @@ if ($action == 'create') {
|
|
|
print '<tr class="liste_titre nodrag nodrop">';
|
|
|
|
|
|
// Adds a line numbering column
|
|
|
- if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
|
|
+ if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
|
|
|
print '<td align="center" width="5"> </td>';
|
|
|
}
|
|
|
print '<td class="minwidth500imp">'.$langs->trans('ModifyAllLines').'</td>';
|
|
@@ -5554,7 +5554,7 @@ if ($action == 'create') {
|
|
|
|
|
|
print '<tr class="nodrag nodrop">';
|
|
|
// Adds a line numbering column
|
|
|
- if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
|
|
+ if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
|
|
|
print '<td align="center" width="5"> </td>';
|
|
|
}
|
|
|
print '<td> </td>';
|
|
@@ -5634,7 +5634,7 @@ if ($action == 'create') {
|
|
|
$ventilExportCompta = $object->getVentilExportCompta();
|
|
|
|
|
|
if ($ventilExportCompta == 0) {
|
|
|
- if (!empty($conf->global->INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) {
|
|
|
+ if (getDolGlobalString('INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE') || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) {
|
|
|
if (!$objectidnext && $object->is_last_in_cycle()) {
|
|
|
if ($usercanunvalidate) {
|
|
|
$params['attr']['title'] = '';
|
|
@@ -5666,7 +5666,7 @@ if ($action == 'create') {
|
|
|
|| ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id))
|
|
|
|| ($object->type == Facture::TYPE_SITUATION && empty($discount->id)))
|
|
|
&& ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data
|
|
|
- && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely)
|
|
|
+ && ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely)
|
|
|
if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted
|
|
|
$params['attr']['title'] = '';
|
|
|
print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken(), '', true, $params);
|
|
@@ -5677,7 +5677,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
// Create contract
|
|
|
- if (!empty($conf->global->CONTRACT_CREATE_FROM_INVOICE)) {
|
|
|
+ if (getDolGlobalString('CONTRACT_CREATE_FROM_INVOICE')) {
|
|
|
if (isModEnabled('contrat') && $object->statut == Facture::STATUS_VALIDATED) {
|
|
|
$langs->load("contracts");
|
|
|
|
|
@@ -5688,7 +5688,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
// Validate
|
|
|
- if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
|
|
|
+ if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (getDolGlobalString('FACTURE_ENABLE_NEGATIVE') || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
|
|
|
if ($usercanvalidate) {
|
|
|
$params['attr']['title'] = '';
|
|
|
print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken(), '', true, $params);
|
|
@@ -5697,7 +5697,7 @@ if ($action == 'create') {
|
|
|
|
|
|
// Send by mail
|
|
|
if (empty($user->socid)) {
|
|
|
- if (($object->statut == Facture::STATUS_VALIDATED || $object->statut == Facture::STATUS_CLOSED) || !empty($conf->global->FACTURE_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
|
|
+ if (($object->statut == Facture::STATUS_VALIDATED || $object->statut == Facture::STATUS_CLOSED) || getDolGlobalString('FACTURE_SENDBYEMAIL_FOR_ALL_STATUS')) {
|
|
|
if ($objectidnext) {
|
|
|
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendMail').'</span>';
|
|
|
} else {
|
|
@@ -5774,7 +5774,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
// For credit note
|
|
|
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercancreate
|
|
|
- && (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $sumofpayment == 0) && $object->total_ht < 0
|
|
|
+ && (getDolGlobalString('INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED') || $sumofpayment == 0) && $object->total_ht < 0
|
|
|
) {
|
|
|
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
|
|
|
}
|
|
@@ -5791,7 +5791,7 @@ if ($action == 'create') {
|
|
|
|
|
|
// Classify paid
|
|
|
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (
|
|
|
- ($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) && $object->total_ttc == $resteapayer))) ||
|
|
|
+ ($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && ($resteapayer <= 0 || (getDolGlobalString('INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID') && $object->total_ttc == $resteapayer))) ||
|
|
|
($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0) ||
|
|
|
($object->type == Facture::TYPE_DEPOSIT && $object->total_ttc > 0)
|
|
|
)
|
|
@@ -5807,12 +5807,12 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
|
|
|
- if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) || $resteapayer != $object->total_ttc) && $usercanissuepayment) {
|
|
|
+ if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (!getDolGlobalString('INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID') || $resteapayer != $object->total_ttc) && $usercanissuepayment) {
|
|
|
if ($totalpaid > 0 || $totalcreditnotes > 0) {
|
|
|
// If one payment or one credit note was linked to this invoice
|
|
|
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
|
|
|
} else {
|
|
|
- if (empty($conf->global->INVOICE_CAN_NEVER_BE_CANCELED)) {
|
|
|
+ if (!getDolGlobalString('INVOICE_CAN_NEVER_BE_CANCELED')) {
|
|
|
if ($objectidnext) {
|
|
|
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ClassifyCanceled').'</span>';
|
|
|
} else {
|
|
@@ -5823,7 +5823,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
// Create a credit note
|
|
|
- if (($object->type == Facture::TYPE_STANDARD || ($object->type == Facture::TYPE_DEPOSIT && empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate) {
|
|
|
+ if (($object->type == Facture::TYPE_STANDARD || ($object->type == Facture::TYPE_DEPOSIT && !getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate) {
|
|
|
if (!$objectidnext) {
|
|
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&fac_avoir='.$object->id.'&action=create&type=2'.($object->fk_project > 0 ? '&projectid='.$object->fk_project : '').($object->entity > 0 ? '&originentity='.$object->entity : '').'">'.$langs->trans("CreateCreditNote").'</a>';
|
|
|
}
|