Merge pull request #13728 from Dolibarr/scrutinizer-patch-7
Scrutinizer Auto-Fixes
This commit is contained in:
commit
2befc9b978
@ -36,13 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
|
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
|
||||||
|
|
||||||
if (! $user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$value = GETPOST('value', 'alpha');
|
$value = GETPOST('value', 'alpha');
|
||||||
$label = GETPOST('label', 'alpha');
|
$label = GETPOST('label', 'alpha');
|
||||||
$scandir = GETPOST('scan_dir', 'alpha');
|
$scandir = GETPOST('scan_dir', 'alpha');
|
||||||
$type='invoice';
|
$type = 'invoice';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -57,17 +57,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
llxHeader(
|
llxHeader(
|
||||||
"", $langs->trans("BillsSetup"),
|
"", $langs->trans("BillsSetup"),
|
||||||
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
|
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
|
||||||
);
|
);
|
||||||
|
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
|
||||||
|
|
||||||
$head = invoice_admin_prepare_head();
|
$head = invoice_admin_prepare_head();
|
||||||
@ -106,12 +106,12 @@ $arrayAvailableType = array(
|
|||||||
);
|
);
|
||||||
$selected = array();
|
$selected = array();
|
||||||
$implodeglue = '+';
|
$implodeglue = '+';
|
||||||
if(!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})){
|
if (!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})) {
|
||||||
$selected = explode('+', $conf->global->{$confkey});
|
$selected = explode('+', $conf->global->{$confkey});
|
||||||
}
|
}
|
||||||
|
|
||||||
$curentInput = (empty($inputCount)?1:($inputCount+1));
|
$curentInput = (empty($inputCount) ? 1 : ($inputCount + 1));
|
||||||
$formSelectInvoiceType = $form->selectarray('value'. $curentInput, $arrayAvailableType, $selected, 1);
|
$formSelectInvoiceType = $form->selectarray('value'.$curentInput, $arrayAvailableType, $selected, 1);
|
||||||
_printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType);
|
_printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType);
|
||||||
|
|
||||||
//_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation'));
|
//_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation'));
|
||||||
@ -126,7 +126,7 @@ $metas = array(
|
|||||||
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
|
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
|
||||||
|
|
||||||
// Conditions paiements
|
// Conditions paiements
|
||||||
$inputCount = empty($inputCount)?1:($inputCount+1);
|
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
|
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
|
||||||
print '<td class="center" width="20"> </td>';
|
print '<td class="center" width="20"> </td>';
|
||||||
@ -178,7 +178,7 @@ function _printOnOff($confkey, $title = false, $desc = '')
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.($title?$title:$langs->trans($confkey));
|
print '<td>'.($title ? $title : $langs->trans($confkey));
|
||||||
if (!empty($desc)) {
|
if (!empty($desc)) {
|
||||||
print '<br><small>'.$langs->trans($desc).'</small>';
|
print '<br><small>'.$langs->trans($desc).'</small>';
|
||||||
}
|
}
|
||||||
@ -206,14 +206,14 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
|
|||||||
{
|
{
|
||||||
global $langs, $conf, $db, $inputCount;
|
global $langs, $conf, $db, $inputCount;
|
||||||
|
|
||||||
$inputCount = empty($inputCount)?1:($inputCount+1);
|
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$defaultMetas = array(
|
$defaultMetas = array(
|
||||||
'name' => 'value'.$inputCount
|
'name' => 'value'.$inputCount
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($type!='textarea') {
|
if ($type != 'textarea') {
|
||||||
$defaultMetas['type'] = 'text';
|
$defaultMetas['type'] = 'text';
|
||||||
$defaultMetas['value'] = $conf->global->{$confkey};
|
$defaultMetas['value'] = $conf->global->{$confkey};
|
||||||
}
|
}
|
||||||
@ -229,9 +229,9 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
if (!empty($help)) {
|
if (!empty($help)) {
|
||||||
print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
|
print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
|
||||||
} else {
|
} else {
|
||||||
print $title?$title:$langs->trans($confkey);
|
print $title ? $title : $langs->trans($confkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($desc)) {
|
if (!empty($desc)) {
|
||||||
@ -244,12 +244,12 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
|
|||||||
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
|
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
|
||||||
|
|
||||||
print '<input type="hidden" name="action" value="setModuleOptions">';
|
print '<input type="hidden" name="action" value="setModuleOptions">';
|
||||||
if ($type=='textarea') {
|
if ($type == 'textarea') {
|
||||||
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
|
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
|
||||||
}elseif($type=='input'){
|
}elseif ($type == 'input') {
|
||||||
print '<input '.$metascompil.' />';
|
print '<input '.$metascompil.' />';
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
// custom
|
// custom
|
||||||
print $type;
|
print $type;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,8 +140,8 @@ $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
|||||||
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
|
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
|
||||||
|
|
||||||
// retained warranty invoice available type
|
// retained warranty invoice available type
|
||||||
$retainedWarrantyInvoiceAvailableType=array();
|
$retainedWarrantyInvoiceAvailableType = array();
|
||||||
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
||||||
$retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY);
|
$retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -952,7 +952,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$discount->tva_tx = abs($tva_tx);
|
$discount->tva_tx = abs($tva_tx);
|
||||||
$discount->vat_src_code =$vat_src_code;
|
$discount->vat_src_code = $vat_src_code;
|
||||||
|
|
||||||
$result = $discount->create($user);
|
$result = $discount->create($user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1362,11 +1362,11 @@ if (empty($reshook))
|
|||||||
$object->situation_cycle_ref = $object->newCycle();
|
$object->situation_cycle_ref = $object->newCycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(in_array($object->type, $retainedWarrantyInvoiceAvailableType)){
|
if (in_array($object->type, $retainedWarrantyInvoiceAvailableType)) {
|
||||||
$object->retained_warranty = GETPOST('retained_warranty', 'int');
|
$object->retained_warranty = GETPOST('retained_warranty', 'int');
|
||||||
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$object->retained_warranty = 0;
|
$object->retained_warranty = 0;
|
||||||
$object->retained_warranty_fk_cond_reglement = 0;
|
$object->retained_warranty_fk_cond_reglement = 0;
|
||||||
}
|
}
|
||||||
@ -1772,15 +1772,15 @@ if (empty($reshook))
|
|||||||
$object->origin_id = $originid;
|
$object->origin_id = $originid;
|
||||||
|
|
||||||
// retained warranty
|
// retained warranty
|
||||||
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY))
|
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY))
|
||||||
{
|
{
|
||||||
$retained_warranty = GETPOST('retained_warranty', 'int');
|
$retained_warranty = GETPOST('retained_warranty', 'int');
|
||||||
if(price2num($retained_warranty) > 0)
|
if (price2num($retained_warranty) > 0)
|
||||||
{
|
{
|
||||||
$object->retained_warranty = price2num($retained_warranty);
|
$object->retained_warranty = price2num($retained_warranty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0)
|
if (GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0)
|
||||||
{
|
{
|
||||||
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
||||||
}
|
}
|
||||||
@ -2629,10 +2629,10 @@ if (empty($reshook))
|
|||||||
$pa_ht = $originLine->pa_ht;
|
$pa_ht = $originLine->pa_ht;
|
||||||
$label = $originLine->label;
|
$label = $originLine->label;
|
||||||
$array_options = $originLine->array_options;
|
$array_options = $originLine->array_options;
|
||||||
if($object->type == Facture::TYPE_SITUATION){
|
if ($object->type == Facture::TYPE_SITUATION) {
|
||||||
$situation_percent = 0;
|
$situation_percent = 0;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$situation_percent = 100;
|
$situation_percent = 100;
|
||||||
}
|
}
|
||||||
$fk_prev_id = '';
|
$fk_prev_id = '';
|
||||||
@ -3393,19 +3393,19 @@ if ($action == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
if($conf->global->INVOICE_USE_RETAINED_WARRANTY){
|
if ($conf->global->INVOICE_USE_RETAINED_WARRANTY) {
|
||||||
$rwStyle = 'display:none;';
|
$rwStyle = 'display:none;';
|
||||||
if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){
|
if (in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)) {
|
||||||
$rwStyle = '';
|
$rwStyle = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$retained_warranty = GETPOST('retained_warranty', 'int');
|
$retained_warranty = GETPOST('retained_warranty', 'int');
|
||||||
if(empty($retained_warranty)){
|
if (empty($retained_warranty)) {
|
||||||
if(!empty($objectsrc->retained_warranty)){ // use previous situation value
|
if (!empty($objectsrc->retained_warranty)) { // use previous situation value
|
||||||
$retained_warranty = $objectsrc->retained_warranty;
|
$retained_warranty = $objectsrc->retained_warranty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
|
$retained_warranty_js_default = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
|
||||||
|
|
||||||
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">';
|
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">';
|
||||||
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
|
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
|
||||||
@ -3413,11 +3413,11 @@ if ($action == 'create')
|
|||||||
// Retained warranty payment term
|
// Retained warranty payment term
|
||||||
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td><td colspan="2">';
|
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td><td colspan="2">';
|
||||||
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
||||||
if(empty($retained_warranty_fk_cond_reglement)){
|
if (empty($retained_warranty_fk_cond_reglement)) {
|
||||||
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
||||||
if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value
|
if (!empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value
|
||||||
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
|
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
|
||||||
}else{
|
} else {
|
||||||
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -813,12 +813,12 @@ class Facture extends CommonInvoice
|
|||||||
$vatrate = $line->tva_tx;
|
$vatrate = $line->tva_tx;
|
||||||
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
|
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
|
||||||
|
|
||||||
if(!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
|
if (!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
|
||||||
$originid=$line->origin_id;
|
$originid = $line->origin_id;
|
||||||
$origintype=$line->origin;
|
$origintype = $line->origin;
|
||||||
} else {
|
} else {
|
||||||
$originid=$line->id;
|
$originid = $line->id;
|
||||||
$origintype=$this->element;
|
$origintype = $this->element;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->addline(
|
$result = $this->addline(
|
||||||
@ -3734,44 +3734,44 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($addon)) {
|
if (!empty($addon)) {
|
||||||
dol_syslog("Call getNextNumRef with " . $addonConstName . " = " . $conf->global->FACTURE_ADDON . ", thirdparty=" . $soc->nom . ", type=" . $soc->typent_code, LOG_DEBUG);
|
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->nom.", type=".$soc->typent_code, LOG_DEBUG);
|
||||||
|
|
||||||
$mybool = false;
|
$mybool = false;
|
||||||
|
|
||||||
|
|
||||||
$file = $addon . '.php';
|
$file = $addon.'.php';
|
||||||
$classname = $addon;
|
$classname = $addon;
|
||||||
|
|
||||||
|
|
||||||
// Include file with class
|
// Include file with class
|
||||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
foreach ($dirmodels as $reldir) {
|
foreach ($dirmodels as $reldir) {
|
||||||
$dir = dol_buildpath($reldir . 'core/modules/' . $moduleName . '/');
|
$dir = dol_buildpath($reldir.'core/modules/'.$moduleName.'/');
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
if (is_file($dir . $file) && is_readable($dir . $file)) {
|
if (is_file($dir.$file) && is_readable($dir.$file)) {
|
||||||
$mybool |= include_once $dir . $file;
|
$mybool |= include_once $dir.$file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For compatibility
|
// For compatibility
|
||||||
if (!$mybool) {
|
if (!$mybool) {
|
||||||
$file = $addon . '/' . $addon . '.modules.php';
|
$file = $addon.'/'.$addon.'.modules.php';
|
||||||
$classname = 'mod_' . $moduleName . '_' . $addon;
|
$classname = 'mod_'.$moduleName.'_'.$addon;
|
||||||
$classname = preg_replace('/\-.*$/', '', $classname);
|
$classname = preg_replace('/\-.*$/', '', $classname);
|
||||||
// Include file with class
|
// Include file with class
|
||||||
foreach ($conf->file->dol_document_root as $dirroot) {
|
foreach ($conf->file->dol_document_root as $dirroot) {
|
||||||
$dir = $dirroot . '/core/modules/' . $moduleName . '/';
|
$dir = $dirroot.'/core/modules/'.$moduleName.'/';
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
if (is_file($dir . $file) && is_readable($dir . $file)) {
|
if (is_file($dir.$file) && is_readable($dir.$file)) {
|
||||||
$mybool |= include_once $dir . $file;
|
$mybool |= include_once $dir.$file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$mybool) {
|
if (!$mybool) {
|
||||||
dol_print_error('', 'Failed to include file ' . $file);
|
dol_print_error('', 'Failed to include file '.$file);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3790,7 +3790,7 @@ class Facture extends CommonInvoice
|
|||||||
return $numref;
|
return $numref;
|
||||||
} else {
|
} else {
|
||||||
$langs->load('errors');
|
$langs->load('errors');
|
||||||
print $langs->trans('Error') . ' ' . $langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
|
print $langs->trans('Error').' '.$langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4756,7 +4756,7 @@ class Facture extends CommonInvoice
|
|||||||
// note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
|
// note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
|
||||||
|
|
||||||
$displayWarranty = false;
|
$displayWarranty = false;
|
||||||
if(!empty($this->retained_warranty)) {
|
if (!empty($this->retained_warranty)) {
|
||||||
$displayWarranty = true;
|
$displayWarranty = true;
|
||||||
|
|
||||||
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) {
|
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) {
|
||||||
@ -4795,7 +4795,7 @@ class Facture extends CommonInvoice
|
|||||||
$retainedWarrantyAmount = 0;
|
$retainedWarrantyAmount = 0;
|
||||||
|
|
||||||
// Billed - retained warranty
|
// Billed - retained warranty
|
||||||
if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION))
|
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION))
|
||||||
{
|
{
|
||||||
$displayWarranty = true;
|
$displayWarranty = true;
|
||||||
// Check if this situation invoice is 100% for real
|
// Check if this situation invoice is 100% for real
|
||||||
@ -4835,7 +4835,7 @@ class Facture extends CommonInvoice
|
|||||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($rounding>0){
|
if ($rounding > 0) {
|
||||||
return round($retainedWarrantyAmount, $rounding);
|
return round($retainedWarrantyAmount, $rounding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -365,7 +365,7 @@ abstract class CommonDocGenerator
|
|||||||
$remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
|
$remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
|
||||||
|
|
||||||
if ($object->fk_account > 0) {
|
if ($object->fk_account > 0) {
|
||||||
require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
$bank_account = new Account($this->db);
|
$bank_account = new Account($this->db);
|
||||||
$bank_account->fetch($object->fk_account);
|
$bank_account->fetch($object->fk_account);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -352,7 +352,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
|
|||||||
|
|
||||||
$content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content);
|
$content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content);
|
||||||
|
|
||||||
if (! empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) {
|
if (!empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) {
|
||||||
$content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);
|
$content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -451,7 +451,7 @@ class modSociete extends DolibarrModules
|
|||||||
's.fk_multicurrency' => 'MulticurrencyUsed',
|
's.fk_multicurrency' => 'MulticurrencyUsed',
|
||||||
's.multicurrency_code' => 'MulticurrencyCurrency'
|
's.multicurrency_code' => 'MulticurrencyCurrency'
|
||||||
);
|
);
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level']='PriceLevel';
|
if (!empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level'] = 'PriceLevel';
|
||||||
// Add extra fields
|
// Add extra fields
|
||||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -64,14 +64,14 @@ if ($id > 0 || !empty($ref))
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($cancel) $action ='';
|
if ($cancel) $action = '';
|
||||||
|
|
||||||
// Action association d'un sousproduit
|
// Action association d'un sousproduit
|
||||||
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
$error=0;
|
$error = 0;
|
||||||
$maxprod = GETPOST("max_prod", 'int');
|
$maxprod = GETPOST("max_prod", 'int');
|
||||||
for ($i=0; $i < $maxprod; $i++)
|
for ($i = 0; $i < $maxprod; $i++)
|
||||||
{
|
{
|
||||||
$qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS');
|
$qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS');
|
||||||
if ($qty > 0)
|
if ($qty > 0)
|
||||||
@ -109,13 +109,13 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
|
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif($action==='save_composed_product')
|
elseif ($action === 'save_composed_product')
|
||||||
{
|
{
|
||||||
$TProduct = GETPOST('TProduct', 'array');
|
$TProduct = GETPOST('TProduct', 'array');
|
||||||
if (!empty($TProduct))
|
if (!empty($TProduct))
|
||||||
@ -540,38 +540,38 @@ if ($id > 0 || !empty($ref))
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i=0;
|
$i = 0;
|
||||||
|
|
||||||
if($num == 0) print '<tr><td colspan="4">'.$langs->trans("NoMatchFound").'</td></tr>';
|
if ($num == 0) print '<tr><td colspan="4">'.$langs->trans("NoMatchFound").'</td></tr>';
|
||||||
|
|
||||||
$MAX = 100;
|
$MAX = 100;
|
||||||
|
|
||||||
while ($i < min($num, $MAX))
|
while ($i < min($num, $MAX))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
if($objp->rowid != $id)
|
if ($objp->rowid != $id)
|
||||||
{
|
{
|
||||||
// check if a product is not already a parent product of this one
|
// check if a product is not already a parent product of this one
|
||||||
$prod_arbo=new Product($db);
|
$prod_arbo = new Product($db);
|
||||||
$prod_arbo->id=$objp->rowid;
|
$prod_arbo->id = $objp->rowid;
|
||||||
// This type is not supported (not required to have virtual products working).
|
// This type is not supported (not required to have virtual products working).
|
||||||
if ($prod_arbo->type == Product::TYPE_ASSEMBLYKIT || $prod_arbo->type == Product::TYPE_STOCKKIT)
|
if ($prod_arbo->type == Product::TYPE_ASSEMBLYKIT || $prod_arbo->type == Product::TYPE_STOCKKIT)
|
||||||
{
|
{
|
||||||
$is_pere=0;
|
$is_pere = 0;
|
||||||
$prod_arbo->get_sousproduits_arbo();
|
$prod_arbo->get_sousproduits_arbo();
|
||||||
// associations sousproduits
|
// associations sousproduits
|
||||||
$prods_arbo = $prod_arbo->get_arbo_each_prod();
|
$prods_arbo = $prod_arbo->get_arbo_each_prod();
|
||||||
if (count($prods_arbo) > 0)
|
if (count($prods_arbo) > 0)
|
||||||
{
|
{
|
||||||
foreach($prods_arbo as $key => $value)
|
foreach ($prods_arbo as $key => $value)
|
||||||
{
|
{
|
||||||
if ($value[1]==$id)
|
if ($value[1] == $id)
|
||||||
{
|
{
|
||||||
$is_pere=1;
|
$is_pere = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($is_pere==1)
|
if ($is_pere == 1)
|
||||||
{
|
{
|
||||||
$i++;
|
$i++;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -129,7 +129,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as t";
|
||||||
if ($category > 0) {
|
if ($category > 0) {
|
||||||
if ($mode != 4) $sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c";
|
if ($mode != 4) $sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c";
|
||||||
if (!in_array($mode, array(1,2,3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc";
|
if (!in_array($mode, array(1, 2, 3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc";
|
||||||
}
|
}
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||||
|
|||||||
@ -118,12 +118,12 @@ class UserGroup extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* @var array List of child tables. To test if we can delete object.
|
* @var array List of child tables. To test if we can delete object.
|
||||||
*/
|
*/
|
||||||
protected $childtables=array();
|
protected $childtables = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array List of child tables. To know object to delete on cascade.
|
* @var array List of child tables. To know object to delete on cascade.
|
||||||
*/
|
*/
|
||||||
protected $childtablesoncascade = array('usergroup_rights','usergroup_user');
|
protected $childtablesoncascade = array('usergroup_rights', 'usergroup_user');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -162,7 +162,7 @@ class UserGroup extends CommonObject
|
|||||||
|
|
||||||
$this->name = $this->nom; // For compatibility with field name
|
$this->name = $this->nom; // For compatibility with field name
|
||||||
|
|
||||||
if($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
if ($load_members)
|
if ($load_members)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -77,7 +77,7 @@ if (empty($reshook)) {
|
|||||||
$editgroup = new Usergroup($db);
|
$editgroup = new Usergroup($db);
|
||||||
$result = $editgroup->fetch($id);
|
$result = $editgroup->fetch($id);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$result= $editgroup->addrights($rights, $module, '', $entity);
|
$result = $editgroup->addrights($rights, $module, '', $entity);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($editgroup->error, $editgroup->errors, 'errors');
|
setEventMessages($editgroup->error, $editgroup->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -327,8 +327,8 @@ if ($cancel)
|
|||||||
|
|
||||||
$savbacktopage = $backtopage;
|
$savbacktopage = $backtopage;
|
||||||
$backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php
|
$backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php
|
||||||
if ($sortfield) $backtopage.='&sortfield='.$sortfield;
|
if ($sortfield) $backtopage .= '&sortfield='.$sortfield;
|
||||||
if ($sortorder) $backtopage.='&sortorder='.$sortorder;
|
if ($sortorder) $backtopage .= '&sortorder='.$sortorder;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||||
$backtopage = $savbacktopage;
|
$backtopage = $savbacktopage;
|
||||||
|
|
||||||
@ -2133,7 +2133,7 @@ print '<div>';
|
|||||||
|
|
||||||
// Add a margin under toolbar ?
|
// Add a margin under toolbar ?
|
||||||
$style = '';
|
$style = '';
|
||||||
if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource' && ! GETPOST('createpagefromclone', 'alphanohtml')) $style = ' margin-bottom: 5px;';
|
if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource' && !GETPOST('createpagefromclone', 'alphanohtml')) $style = ' margin-bottom: 5px;';
|
||||||
|
|
||||||
|
|
||||||
if (!GETPOST('hide_websitemenu'))
|
if (!GETPOST('hide_websitemenu'))
|
||||||
@ -2437,7 +2437,7 @@ if (!GETPOST('hide_websitemenu'))
|
|||||||
$preselectedlanguage = GETPOST('newlang', 'aZ09') ? GETPOST('newlang', 'aZ09') : ($objectpage->lang ? $objectpage->lang : $langs->defaultlang);
|
$preselectedlanguage = GETPOST('newlang', 'aZ09') ? GETPOST('newlang', 'aZ09') : ($objectpage->lang ? $objectpage->lang : $langs->defaultlang);
|
||||||
$onlylang = array();
|
$onlylang = array();
|
||||||
if ($website->otherlang) {
|
if ($website->otherlang) {
|
||||||
foreach(explode(',', $website->otherlang) as $langkey) {
|
foreach (explode(',', $website->otherlang) as $langkey) {
|
||||||
$onlylang[$langkey] = $langkey;
|
$onlylang[$langkey] = $langkey;
|
||||||
}
|
}
|
||||||
$textifempty = 1;
|
$textifempty = 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user