@@ -321,7 +321,7 @@  | 
                                                    ||
| 321 | 321 | $sql .= $db->plimit($max, 0);  | 
                                                        
| 322 | 322 | |
| 323 | 323 | //print $sql;  | 
                                                        
| 324 | - $lastmodified="";  | 
                                                        |
| 324 | + $lastmodified = "";  | 
                                                        |
| 325 | 325 | $result = $db->query($sql);  | 
                                                        
| 326 | 326 |  	if ($result) { | 
                                                        
| 327 | 327 | $num = $db->num_rows($result);  | 
                                                        
@@ -718,7 +718,7 @@ discard block  | 
                                                    ||
| 718 | 718 | // Ajout directives pour resoudre bug IE  | 
                                                        
| 719 | 719 |  		header('Cache-Control: Public, must-revalidate'); | 
                                                        
| 720 | 720 |  		header('Pragma: public'); | 
                                                        
| 721 | -		header('Content-Length: ' . dol_filesize($downloadFilePath)); | 
                                                        |
| 721 | +		header('Content-Length: '.dol_filesize($downloadFilePath)); | 
                                                        |
| 722 | 722 | |
| 723 | 723 | readfileLowMemory($downloadFilePath);  | 
                                                        
| 724 | 724 |  	} else { | 
                                                        
@@ -791,7 +791,7 @@ discard block  | 
                                                    ||
| 791 | 791 | $form_question['formatexport'] = array(  | 
                                                        
| 792 | 792 | 'name' => 'formatexport',  | 
                                                        
| 793 | 793 | 'type' => 'select',  | 
                                                        
| 794 | -		'label' => $langs->trans('Modelcsv'),		// TODO  Use Selectmodelcsv and show a select combo | 
                                                        |
| 794 | +		'label' => $langs->trans('Modelcsv'), // TODO  Use Selectmodelcsv and show a select combo | 
                                                        |
| 795 | 795 | 'values' => $listofformat,  | 
                                                        
| 796 | 796 | 'default' => $formatexportset,  | 
                                                        
| 797 | 797 | 'morecss' => 'minwidth200 maxwidth200'  | 
                                                        
@@ -1320,7 +1320,7 @@ discard block  | 
                                                    ||
| 1320 | 1320 | |
| 1321 | 1321 | $labeltoshow = '';  | 
                                                        
| 1322 | 1322 | $labeltoshowalt = '';  | 
                                                        
| 1323 | -		if (($objectstatic instanceof CommonObject)  && in_array($line->doc_type, array('customer_invoice', 'supplier_invoice', 'expense_report'))) { | 
                                                        |
| 1323 | +		if (($objectstatic instanceof CommonObject) && in_array($line->doc_type, array('customer_invoice', 'supplier_invoice', 'expense_report'))) { | 
                                                        |
| 1324 | 1324 |  			if ($objectstatic->id > 0) { | 
                                                        
| 1325 | 1325 | $labeltoshow .= $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);  | 
                                                        
| 1326 | 1326 | $labeltoshow .= $documentlink;  | 
                                                        
@@ -1332,8 +1332,8 @@ discard block  | 
                                                    ||
| 1332 | 1332 | $labeltoshow .= $objectstatic->getNomUrl(1);  | 
                                                        
| 1333 | 1333 | $labeltoshowalt .= $objectstatic->ref;  | 
                                                        
| 1334 | 1334 | $bank_ref = strstr($line->doc_ref, '-');  | 
                                                        
| 1335 | - $labeltoshow .= " " . $bank_ref;  | 
                                                        |
| 1336 | - $labeltoshowalt .= " " . $bank_ref;  | 
                                                        |
| 1335 | + $labeltoshow .= " ".$bank_ref;  | 
                                                        |
| 1336 | + $labeltoshowalt .= " ".$bank_ref;  | 
                                                        |
| 1337 | 1337 |  		} else { | 
                                                        
| 1338 | 1338 | $labeltoshow .= $line->doc_ref;  | 
                                                        
| 1339 | 1339 | $labeltoshowalt .= $line->doc_ref;  | 
                                                        
@@ -48,8 +48,8 @@ discard block  | 
                                                    ||
| 48 | 48 | require_once DOL_DOCUMENT_ROOT."/core/class/html.formcontract.class.php";  | 
                                                        
| 49 | 49 | require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php";  | 
                                                        
| 50 | 50 | }  | 
                                                        
| 51 | -if (getDolGlobalString('FICHEINTER_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/fichinter/mod_" . getDolGlobalString('FICHEINTER_ADDON').".php")) { | 
                                                        |
| 52 | -	require_once DOL_DOCUMENT_ROOT."/core/modules/fichinter/mod_" . getDolGlobalString('FICHEINTER_ADDON').'.php'; | 
                                                        |
| 51 | +if (getDolGlobalString('FICHEINTER_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/fichinter/mod_".getDolGlobalString('FICHEINTER_ADDON').".php")) { | 
                                                        |
| 52 | +	require_once DOL_DOCUMENT_ROOT."/core/modules/fichinter/mod_".getDolGlobalString('FICHEINTER_ADDON').'.php'; | 
                                                        |
| 53 | 53 | }  | 
                                                        
| 54 | 54 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';  | 
                                                        
| 55 | 55 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';  | 
                                                        
@@ -59,7 +59,7 @@ discard block  | 
                                                    ||
| 59 | 59 | |
| 60 | 60 |  $id			= GETPOSTINT('id'); | 
                                                        
| 61 | 61 |  $ref		= GETPOST('ref', 'alpha'); | 
                                                        
| 62 | -$ref_client	= GETPOST('ref_client', 'alpha'); | 
                                                        |
| 62 | +$ref_client = GETPOST('ref_client', 'alpha'); | 
                                                        |
| 63 | 63 |  $socid = GETPOSTINT('socid'); | 
                                                        
| 64 | 64 |  $contratid = GETPOSTINT('contratid'); | 
                                                        
| 65 | 65 |  $action		= GETPOST('action', 'alpha'); | 
                                                        
@@ -220,7 +220,7 @@ discard block  | 
                                                    ||
| 220 | 220 |  				$result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->model_pdf : GETPOST('model', 'alpha'), $outputlangs); | 
                                                        
| 221 | 221 | }  | 
                                                        
| 222 | 222 | |
| 223 | -			header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); | 
                                                        |
| 223 | +			header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); | 
                                                        |
| 224 | 224 | exit;  | 
                                                        
| 225 | 225 |  		} else { | 
                                                        
| 226 | 226 | $mesg = $object->error;  | 
                                                        
@@ -1070,7 +1070,7 @@ discard block  | 
                                                    ||
| 1070 | 1070 |  	} else { | 
                                                        
| 1071 | 1071 | print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';  | 
                                                        
| 1072 | 1072 | print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
| 1073 | - print '<input type="hidden" name="action" value="create">'; // We go back to create action  | 
                                                        |
| 1073 | + print '<input type="hidden" name="action" value="create">'; // We go back to create action  | 
                                                        |
| 1074 | 1074 | print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';  | 
                                                        
| 1075 | 1075 | |
| 1076 | 1076 |  		print dol_get_fiche_head(''); | 
                                                        
@@ -84,7 +84,7 @@ discard block  | 
                                                    ||
| 84 | 84 |  $search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha'); | 
                                                        
| 85 | 85 |  $search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat', 'alpha'); | 
                                                        
| 86 | 86 |  $search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha'); | 
                                                        
| 87 | -$search_status = GETPOST('search_status', 'intcomma');	// Can be '' or a numeric | 
                                                        |
| 87 | +$search_status = GETPOST('search_status', 'intcomma'); // Can be '' or a numeric | 
                                                        |
| 88 | 88 |  $search_paymentmode = GETPOST('search_paymentmode', 'intcomma'); | 
                                                        
| 89 | 89 |  $search_paymentcond = GETPOST('search_paymentcond', 'intcomma'); | 
                                                        
| 90 | 90 |  $search_town = GETPOST('search_town', 'alpha'); | 
                                                        
@@ -212,7 +212,7 @@ discard block  | 
                                                    ||
| 212 | 212 | |
| 213 | 213 | $object->fields = dol_sort_array($object->fields, 'position');  | 
                                                        
| 214 | 214 | $arrayfields = dol_sort_array($arrayfields, 'position');  | 
                                                        
| 215 | -'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';  // dol_sort_array looses type for Phan | 
                                                        |
| 215 | +'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan | 
                                                        |
| 216 | 216 | |
| 217 | 217 |  if (!isModEnabled('supplier_invoice')) { | 
                                                        
| 218 | 218 | accessforbidden();  | 
                                                        
@@ -620,16 +620,16 @@ discard block  | 
                                                    ||
| 620 | 620 | $sql .= " AND f.fk_cond_reglement = ".((int) $search_paymentcond);  | 
                                                        
| 621 | 621 | }  | 
                                                        
| 622 | 622 |  if ($search_date_start) { | 
                                                        
| 623 | - $sql .= " AND f.datef >= '" . $db->idate($search_date_start) . "'";  | 
                                                        |
| 623 | + $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";  | 
                                                        |
| 624 | 624 | }  | 
                                                        
| 625 | 625 |  if ($search_date_end) { | 
                                                        
| 626 | - $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";  | 
                                                        |
| 626 | + $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";  | 
                                                        |
| 627 | 627 | }  | 
                                                        
| 628 | 628 |  if ($search_datelimit_start) { | 
                                                        
| 629 | - $sql .= " AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) . "'";  | 
                                                        |
| 629 | + $sql .= " AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start)."'";  | 
                                                        |
| 630 | 630 | }  | 
                                                        
| 631 | 631 |  if ($search_datelimit_end) { | 
                                                        
| 632 | - $sql .= " AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) . "'";  | 
                                                        |
| 632 | + $sql .= " AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end)."'";  | 
                                                        |
| 633 | 633 | }  | 
                                                        
| 634 | 634 |  if ($option == 'late') { | 
                                                        
| 635 | 635 | $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'";  | 
                                                        
@@ -658,7 +658,7 @@ discard block  | 
                                                    ||
| 658 | 658 |  			if ($searchCategorySupplierOperator == 0) { | 
                                                        
| 659 | 659 | $searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).")";  | 
                                                        
| 660 | 660 |  			} else { | 
                                                        
| 661 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier);  | 
                                                        |
| 661 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategorySupplier);  | 
                                                        |
| 662 | 662 | }  | 
                                                        
| 663 | 663 | }  | 
                                                        
| 664 | 664 | }  | 
                                                        
@@ -688,7 +688,7 @@ discard block  | 
                                                    ||
| 688 | 688 |  			if ($searchCategoryProductOperator == 0) { | 
                                                        
| 689 | 689 | $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";  | 
                                                        
| 690 | 690 |  			} else { | 
                                                        
| 691 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);  | 
                                                        |
| 691 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProduct);  | 
                                                        |
| 692 | 692 | }  | 
                                                        
| 693 | 693 | }  | 
                                                        
| 694 | 694 | }  | 
                                                        
@@ -190,7 +190,7 @@ discard block  | 
                                                    ||
| 190 | 190 | // Action clone object  | 
                                                        
| 191 | 191 |  	if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) { | 
                                                        
| 192 | 192 | $objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone. We use native clone to keep this->db valid.  | 
                                                        
| 193 | - '@phan-var-force FactureFournisseur $objectutil'; // Same object type for cloned object  | 
                                                        |
| 193 | + '@phan-var-force FactureFournisseur $objectutil'; // Same object type for cloned object  | 
                                                        |
| 194 | 194 | |
| 195 | 195 |  		if (GETPOST('newsupplierref', 'alphanohtml')) { | 
                                                        
| 196 | 196 |  			$objectutil->ref_supplier = GETPOST('newsupplierref', 'alphanohtml'); | 
                                                        
@@ -776,7 +776,7 @@ discard block  | 
                                                    ||
| 776 | 776 | $db->begin();  | 
                                                        
| 777 | 777 | |
| 778 | 778 | $error = 0;  | 
                                                        
| 779 | - $tmpproject = 0; // Ensure a value  | 
                                                        |
| 779 | + $tmpproject = 0; // Ensure a value  | 
                                                        |
| 780 | 780 | |
| 781 | 781 | // Fill array 'array_options' with data from add form  | 
                                                        
| 782 | 782 | $ret = $extrafields->setOptionalsFromPost(null, $object);  | 
                                                        
@@ -784,7 +784,7 @@ discard block  | 
                                                    ||
| 784 | 784 | $error++;  | 
                                                        
| 785 | 785 | }  | 
                                                        
| 786 | 786 | |
| 787 | -		$dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver');	// If we enter the 02 january, we need to save the 02 january for server | 
                                                        |
| 787 | +		$dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server | 
                                                        |
| 788 | 788 |  		$datedue = dol_mktime(0, 0, 0, GETPOSTINT('echmonth'), GETPOSTINT('echday'), GETPOSTINT('echyear'), 'tzserver'); | 
                                                        
| 789 | 789 | //var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour'));  | 
                                                        
| 790 | 790 |  		//var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour')); | 
                                                        
@@ -823,7 +823,7 @@ discard block  | 
                                                    ||
| 823 | 823 |  				$object->ref_supplier = GETPOST('ref_supplier', 'alpha'); | 
                                                        
| 824 | 824 |  				$object->socid = GETPOSTINT('socid'); | 
                                                        
| 825 | 825 |  				$object->label = GETPOST('label', 'alphanohtml'); | 
                                                        
| 826 | - $object->libelle = $object->label; // deprecated  | 
                                                        |
| 826 | + $object->libelle = $object->label; // deprecated  | 
                                                        |
| 827 | 827 | $object->date = $dateinvoice;  | 
                                                        
| 828 | 828 | $object->date_echeance = $datedue;  | 
                                                        
| 829 | 829 |  				$object->note_public = GETPOST('note_public', 'restricthtml'); | 
                                                        
@@ -897,7 +897,7 @@ discard block  | 
                                                    ||
| 897 | 897 |  				$object->subtype            = GETPOST('subtype', 'alphanohtml'); | 
                                                        
| 898 | 898 |  				$object->socid				= GETPOSTINT('socid'); | 
                                                        
| 899 | 899 |  				$object->label				= GETPOST('label', 'alphanohtml'); | 
                                                        
| 900 | - $object->libelle = $object->label; // Deprecated  | 
                                                        |
| 900 | + $object->libelle = $object->label; // Deprecated  | 
                                                        |
| 901 | 901 | $object->date = $dateinvoice;  | 
                                                        
| 902 | 902 | $object->date_echeance = $datedue;  | 
                                                        
| 903 | 903 |  				$object->note_public        = GETPOST('note_public', 'restricthtml'); | 
                                                        
@@ -1007,7 +1007,7 @@ discard block  | 
                                                    ||
| 1007 | 1007 |  				$object->cond_reglement_id	= (GETPOSTINT('type') == 3 ? 1 : GETPOST('cond_reglement_id')); | 
                                                        
| 1008 | 1008 |  				$object->mode_reglement_id	= GETPOSTINT('mode_reglement_id'); | 
                                                        
| 1009 | 1009 |  				$object->fk_account         = GETPOSTINT('fk_account'); | 
                                                        
| 1010 | -				$object->amount             = (float) price2num(GETPOST('amount'));  // FIXME: FactureFournisseur::$amount is deprecated and not used? | 
                                                        |
| 1010 | +				$object->amount             = (float) price2num(GETPOST('amount')); // FIXME: FactureFournisseur::$amount is deprecated and not used? | 
                                                        |
| 1011 | 1011 |  				//$object->remise_absolue		= price2num(GETPOST('remise_absolue'), 'MU'); | 
                                                        
| 1012 | 1012 |  				//$object->remise_percent		= price2num(GETPOST('remise_percent'), '', 2); | 
                                                        
| 1013 | 1013 |  				$object->fk_incoterms       = GETPOSTINT('incoterm_id'); | 
                                                        
@@ -1060,28 +1060,28 @@ discard block  | 
                                                    ||
| 1060 | 1060 |  				$tmpproject = GETPOSTINT('projectid'); | 
                                                        
| 1061 | 1061 | |
| 1062 | 1062 | // Creation invoice  | 
                                                        
| 1063 | -				$object->socid				= GETPOSTINT('socid'); | 
                                                        |
| 1064 | -				$object->type				= GETPOST('type', 'alphanohtml'); | 
                                                        |
| 1065 | -				$object->subtype            = GETPOSTINT('subtype'); | 
                                                        |
| 1066 | -				$object->ref				= GETPOST('ref', 'alphanohtml'); | 
                                                        |
| 1067 | -				$object->ref_supplier		= GETPOST('ref_supplier', 'alphanohtml'); | 
                                                        |
| 1063 | +				$object->socid = GETPOSTINT('socid'); | 
                                                        |
| 1064 | +				$object->type = GETPOST('type', 'alphanohtml'); | 
                                                        |
| 1065 | +				$object->subtype = GETPOSTINT('subtype'); | 
                                                        |
| 1066 | +				$object->ref = GETPOST('ref', 'alphanohtml'); | 
                                                        |
| 1067 | +				$object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); | 
                                                        |
| 1068 | 1068 |  				$object->socid				= GETPOSTINT('socid'); | 
                                                        
| 1069 | 1069 |  				$object->label				= GETPOST('label', 'alphanohtml'); | 
                                                        
| 1070 | - $object->libelle = $object->label; // deprecated  | 
                                                        |
| 1071 | - $object->date = $dateinvoice;  | 
                                                        |
| 1072 | - $object->date_echeance = $datedue;  | 
                                                        |
| 1073 | -				$object->note_public		= GETPOST('note_public', 'restricthtml'); | 
                                                        |
| 1074 | -				$object->note_private		= GETPOST('note_private', 'restricthtml'); | 
                                                        |
| 1070 | + $object->libelle = $object->label; // deprecated  | 
                                                        |
| 1071 | + $object->date = $dateinvoice;  | 
                                                        |
| 1072 | + $object->date_echeance = $datedue;  | 
                                                        |
| 1073 | +				$object->note_public = GETPOST('note_public', 'restricthtml'); | 
                                                        |
| 1074 | +				$object->note_private = GETPOST('note_private', 'restricthtml'); | 
                                                        |
| 1075 | 1075 |  				$object->cond_reglement_id	= GETPOST('cond_reglement_id'); | 
                                                        
| 1076 | 1076 |  				$object->mode_reglement_id	= GETPOST('mode_reglement_id'); | 
                                                        
| 1077 | 1077 |  				$object->fk_account			= GETPOSTINT('fk_account'); | 
                                                        
| 1078 | 1078 |  				$object->vat_reverse_charge	= GETPOST('vat_reverse_charge') == 'on' ? 1 : 0; | 
                                                        
| 1079 | 1079 | $object->fk_project = ($tmpproject > 0) ? $tmpproject : null;  | 
                                                        
| 1080 | -				$object->fk_incoterms		= GETPOSTINT('incoterm_id'); | 
                                                        |
| 1080 | +				$object->fk_incoterms = GETPOSTINT('incoterm_id'); | 
                                                        |
| 1081 | 1081 |  				$object->location_incoterms	= GETPOST('location_incoterms', 'alpha'); | 
                                                        
| 1082 | 1082 |  				$object->multicurrency_code	= GETPOST('multicurrency_code', 'alpha'); | 
                                                        
| 1083 | -				$object->multicurrency_tx	= GETPOSTINT('originmulticurrency_tx'); | 
                                                        |
| 1084 | -				$object->transport_mode_id	= GETPOSTINT('transport_mode_id'); | 
                                                        |
| 1083 | +				$object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx'); | 
                                                        |
| 1084 | +				$object->transport_mode_id = GETPOSTINT('transport_mode_id'); | 
                                                        |
| 1085 | 1085 | |
| 1086 | 1086 | // Auto calculation of date due if not filled by user  | 
                                                        
| 1087 | 1087 |  				if (empty($object->date_echeance)) { | 
                                                        
@@ -1293,7 +1293,7 @@ discard block  | 
                                                    ||
| 1293 | 1293 | 0,  | 
                                                        
| 1294 | 1294 | $object->lines[0]->date_start,  | 
                                                        
| 1295 | 1295 | $object->lines[0]->date_end,  | 
                                                        
| 1296 | - array(), // array_options  | 
                                                        |
| 1296 | + array(), // array_options  | 
                                                        |
| 1297 | 1297 | 0,  | 
                                                        
| 1298 | 1298 | 0,  | 
                                                        
| 1299 | 1299 | '',  | 
                                                        
@@ -1425,7 +1425,7 @@ discard block  | 
                                                    ||
| 1425 | 1425 | // Edit line  | 
                                                        
| 1426 | 1426 | $db->begin();  | 
                                                        
| 1427 | 1427 | |
| 1428 | -		if (! $object->fetch($id) > 0) { | 
                                                        |
| 1428 | +		if (!$object->fetch($id) > 0) { | 
                                                        |
| 1429 | 1429 | dol_print_error($db);  | 
                                                        
| 1430 | 1430 | }  | 
                                                        
| 1431 | 1431 | $object->fetch_thirdparty();  | 
                                                        
@@ -1569,7 +1569,7 @@ discard block  | 
                                                    ||
| 1569 | 1569 |  			$idprod = GETPOSTINT('idprod'); | 
                                                        
| 1570 | 1570 | }  | 
                                                        
| 1571 | 1571 | |
| 1572 | -		$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);		// Can be '1.2' or '1.2 (CODE)' | 
                                                        |
| 1572 | +		$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' | 
                                                        |
| 1573 | 1573 | |
| 1574 | 1574 |  		$price_ht = price2num(GETPOST('price_ht'), 'MU', 2); | 
                                                        
| 1575 | 1575 |  		$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); | 
                                                        
@@ -2073,7 +2073,7 @@ discard block  | 
                                                    ||
| 2073 | 2073 | // Mode creation  | 
                                                        
| 2074 | 2074 |  if ($action == 'create') { | 
                                                        
| 2075 | 2075 | $facturestatic = new FactureFournisseur($db);  | 
                                                        
| 2076 | - $selectedLines = array(); // Ensure initialised  | 
                                                        |
| 2076 | + $selectedLines = array(); // Ensure initialised  | 
                                                        |
| 2077 | 2077 | |
| 2078 | 2078 |  	print load_fiche_titre($langs->trans('NewSupplierInvoice'), '', 'supplier_invoice'); | 
                                                        
| 2079 | 2079 | |
@@ -2266,7 +2266,7 @@ discard block  | 
                                                    ||
| 2266 | 2266 | print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';  | 
                                                        
| 2267 | 2267 | print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
| 2268 | 2268 | print '<input type="hidden" name="action" value="add">';  | 
                                                        
| 2269 | - print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change  | 
                                                        |
| 2269 | + print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change  | 
                                                        |
| 2270 | 2270 | |
| 2271 | 2271 |  	if (!empty($societe->id) && $societe->id > 0) { | 
                                                        
| 2272 | 2272 | print '<input type="hidden" name="socid" value="'.$societe->id.'">'."\n";  | 
                                                        
@@ -2350,7 +2350,7 @@ discard block  | 
                                                    ||
| 2350 | 2350 | |
| 2351 | 2351 | $sql = 'SELECT r.rowid, r.titre as title, r.total_ttc';  | 
                                                        
| 2352 | 2352 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_rec as r';  | 
                                                        
| 2353 | - $sql .= ' WHERE r.fk_soc = '. (int) $invoice_predefined->socid;  | 
                                                        |
| 2353 | + $sql .= ' WHERE r.fk_soc = '.(int) $invoice_predefined->socid;  | 
                                                        |
| 2354 | 2354 | |
| 2355 | 2355 | $resql = $db->query($sql);  | 
                                                        
| 2356 | 2356 |  			if ($resql) { | 
                                                        
@@ -2417,7 +2417,7 @@ discard block  | 
                                                    ||
| 2417 | 2417 | // Deposit - Down payment  | 
                                                        
| 2418 | 2418 |  			if (!getDolGlobalString('INVOICE_DISABLE_DEPOSIT')) { | 
                                                        
| 2419 | 2419 | print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';  | 
                                                        
| 2420 | -				$tmp = '<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOSTINT('type') == 3 ? ' checked' : '') . '> '; | 
                                                        |
| 2420 | +				$tmp = '<input type="radio" id="radio_deposit" name="type" value="3"'.(GETPOSTINT('type') == 3 ? ' checked' : '').'> '; | 
                                                        |
| 2421 | 2421 | print '<script type="text/javascript">  | 
                                                        
| 2422 | 2422 |  				jQuery(document).ready(function() { | 
                                                        
| 2423 | 2423 |  					jQuery("#typestandardinvoice, #valuestandardinvoice").click(function() { | 
                                                        
@@ -2464,7 +2464,7 @@ discard block  | 
                                                    ||
| 2464 | 2464 |  					print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit', 'aZ09'), 0, 0, 0, '', 1); | 
                                                        
| 2465 | 2465 | print '</td>';  | 
                                                        
| 2466 | 2466 | print '<td class="nowrap" style="padding-left: 5px">';  | 
                                                        
| 2467 | -					print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="' . GETPOSTINT('valuedeposit') . '"/>'; | 
                                                        |
| 2467 | +					print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="'.GETPOSTINT('valuedeposit').'"/>'; | 
                                                        |
| 2468 | 2468 | print '</td>';  | 
                                                        
| 2469 | 2469 | }  | 
                                                        
| 2470 | 2470 | print '</tr></table>';  | 
                                                        
@@ -2714,8 +2714,8 @@ discard block  | 
                                                    ||
| 2714 | 2714 | |
| 2715 | 2715 | // Vat reverse-charge by default  | 
                                                        
| 2716 | 2716 |  		if (getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) { | 
                                                        
| 2717 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 2718 | -			print '<tr><td>' . $langs->trans('VATReverseCharge') . '</td><td>'; | 
                                                        |
| 2717 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 2718 | +			print '<tr><td>'.$langs->trans('VATReverseCharge').'</td><td>'; | 
                                                        |
| 2719 | 2719 | // Try to propose to use VAT reverse charge even if the VAT reverse charge is not activated in the supplier card, if this corresponds to the context of use, the activation is proposed  | 
                                                        
| 2720 | 2720 |  			if ($vat_reverse_charge == 1 || $societe->vat_reverse_charge == 1 || ($societe->country_code != 'FR' && isInEEC($societe) && !empty($societe->tva_intra))) { | 
                                                        
| 2721 | 2721 | $vat_reverse_charge = 1;  | 
                                                        
@@ -2723,7 +2723,7 @@ discard block  | 
                                                    ||
| 2723 | 2723 | $vat_reverse_charge = 0;  | 
                                                        
| 2724 | 2724 | }  | 
                                                        
| 2725 | 2725 | |
| 2726 | - print '<input type="checkbox" name="vat_reverse_charge"'. (!empty($vat_reverse_charge) ? ' checked ' : '') . '>';  | 
                                                        |
| 2726 | + print '<input type="checkbox" name="vat_reverse_charge"'.(!empty($vat_reverse_charge) ? ' checked ' : '').'>';  | 
                                                        |
| 2727 | 2727 | print '</td></tr>';  | 
                                                        
| 2728 | 2728 | }  | 
                                                        
| 2729 | 2729 | |
@@ -3293,7 +3293,7 @@ discard block  | 
                                                    ||
| 3293 | 3293 | $facavoir->fetch($id);  | 
                                                        
| 3294 | 3294 | $invoicecredits[] = $facavoir->getNomUrl(1);  | 
                                                        
| 3295 | 3295 | }  | 
                                                        
| 3296 | -				print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits); | 
                                                        |
| 3296 | +				print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir").(count($invoicecredits) ? ' ' : '').implode(',', $invoicecredits); | 
                                                        |
| 3297 | 3297 | print '</span>';  | 
                                                        
| 3298 | 3298 | }  | 
                                                        
| 3299 | 3299 |  			if (isset($objectidnext) && $objectidnext > 0) { | 
                                                        
@@ -3489,12 +3489,12 @@ discard block  | 
                                                    ||
| 3489 | 3489 | print '<input type="hidden" name="action" value="setvatreversecharge">';  | 
                                                        
| 3490 | 3490 | print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
| 3491 | 3491 | |
| 3492 | - print '<input type="checkbox" name="vat_reverse_charge"' . ($object->vat_reverse_charge == '1' ? ' checked ' : '') . '>';  | 
                                                        |
| 3492 | + print '<input type="checkbox" name="vat_reverse_charge"'.($object->vat_reverse_charge == '1' ? ' checked ' : '').'>';  | 
                                                        |
| 3493 | 3493 | |
| 3494 | 3494 |  					print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        
| 3495 | 3495 | print '</form>';  | 
                                                        
| 3496 | 3496 |  				} else { | 
                                                        
| 3497 | - print '<input type="checkbox" name="vat_reverse_charge"'. ($object->vat_reverse_charge == '1' ? ' checked ' : '') . ' disabled>';  | 
                                                        |
| 3497 | + print '<input type="checkbox" name="vat_reverse_charge"'.($object->vat_reverse_charge == '1' ? ' checked ' : '').' disabled>';  | 
                                                        |
| 3498 | 3498 | }  | 
                                                        
| 3499 | 3499 | print '</td></tr>';  | 
                                                        
| 3500 | 3500 | }  | 
                                                        
@@ -3556,15 +3556,15 @@ discard block  | 
                                                    ||
| 3556 | 3556 | print '<table class="border tableforfield centpercent">';  | 
                                                        
| 3557 | 3557 | |
| 3558 | 3558 | print '<tr>';  | 
                                                        
| 3559 | -			print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; | 
                                                        |
| 3560 | - print '<td class="nowrap amountcard right">' . price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';  | 
                                                        |
| 3559 | +			print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; | 
                                                        |
| 3560 | + print '<td class="nowrap amountcard right">'.price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency).'</td>';  | 
                                                        |
| 3561 | 3561 |  			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { | 
                                                        
| 3562 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';  | 
                                                        |
| 3562 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';  | 
                                                        |
| 3563 | 3563 | }  | 
                                                        
| 3564 | 3564 | print '</tr>';  | 
                                                        
| 3565 | 3565 | |
| 3566 | 3566 | print '<tr>';  | 
                                                        
| 3567 | -			print '<td>' . $langs->trans('AmountVAT') . '</td>'; | 
                                                        |
| 3567 | +			print '<td>'.$langs->trans('AmountVAT').'</td>'; | 
                                                        |
| 3568 | 3568 | print '<td class="nowrap amountcard right">';  | 
                                                        
| 3569 | 3569 |  			if (GETPOST('calculationrule')) { | 
                                                        
| 3570 | 3570 |  				$calculationrule = GETPOST('calculationrule', 'alpha'); | 
                                                        
@@ -3578,40 +3578,40 @@ discard block  | 
                                                    ||
| 3578 | 3578 | }  | 
                                                        
| 3579 | 3579 | // Show link for "recalculate"  | 
                                                        
| 3580 | 3580 |  			if ($object->getVentilExportCompta() == 0) { | 
                                                        
| 3581 | -				$s = '<span class="hideonsmartphone opacitymedium">' . $langs->trans("ReCalculate") . ' </span>'; | 
                                                        |
| 3582 | -				$s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&calculationrule=totalofround">' . $langs->trans("Mode1") . '</a>'; | 
                                                        |
| 3581 | +				$s = '<span class="hideonsmartphone opacitymedium">'.$langs->trans("ReCalculate").' </span>'; | 
                                                        |
| 3582 | +				$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>'; | 
                                                        |
| 3583 | 3583 | $s .= ' / ';  | 
                                                        
| 3584 | -				$s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&calculationrule=roundoftotal">' . $langs->trans("Mode2") . '</a>'; | 
                                                        |
| 3584 | +				$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>'; | 
                                                        |
| 3585 | 3585 | print '<div class="inline-block">';  | 
                                                        
| 3586 | -				print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum) . '<br>' . $langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); | 
                                                        |
| 3586 | +				print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'<br>'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); | 
                                                        |
| 3587 | 3587 | print '       ';  | 
                                                        
| 3588 | 3588 | print '</div>';  | 
                                                        
| 3589 | 3589 | }  | 
                                                        
| 3590 | 3590 | print price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency);  | 
                                                        
| 3591 | 3591 | print '</td>';  | 
                                                        
| 3592 | 3592 |  			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { | 
                                                        
| 3593 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';  | 
                                                        |
| 3593 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';  | 
                                                        |
| 3594 | 3594 | }  | 
                                                        
| 3595 | 3595 | print '</tr>';  | 
                                                        
| 3596 | 3596 | |
| 3597 | 3597 |  			if ($societe->localtax1_assuj == "1") { //Localtax1 | 
                                                        
| 3598 | 3598 | print '<tr>';  | 
                                                        
| 3599 | -				print '<td>' . $langs->transcountry("AmountLT1", $societe->country_code) . '</td>'; | 
                                                        |
| 3600 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency) . '</td>';  | 
                                                        |
| 3599 | +				print '<td>'.$langs->transcountry("AmountLT1", $societe->country_code).'</td>'; | 
                                                        |
| 3600 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).'</td>';  | 
                                                        |
| 3601 | 3601 | print '</tr>';  | 
                                                        
| 3602 | 3602 | }  | 
                                                        
| 3603 | 3603 |  			if ($societe->localtax2_assuj == "1") { //Localtax2 | 
                                                        
| 3604 | 3604 | print '<tr>';  | 
                                                        
| 3605 | -				print '<td>' . $langs->transcountry("AmountLT2", $societe->country_code) . '</td>'; | 
                                                        |
| 3606 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency) . '</td>';  | 
                                                        |
| 3605 | +				print '<td>'.$langs->transcountry("AmountLT2", $societe->country_code).'</td>'; | 
                                                        |
| 3606 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).'</td>';  | 
                                                        |
| 3607 | 3607 | print '</tr>';  | 
                                                        
| 3608 | 3608 | }  | 
                                                        
| 3609 | 3609 | |
| 3610 | 3610 | print '<tr>';  | 
                                                        
| 3611 | -			print '<td>' . $langs->trans('AmountTTC') . '</td>'; | 
                                                        |
| 3612 | - print '<td class="nowrap amountcard right">' . price($object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';  | 
                                                        |
| 3611 | +			print '<td>'.$langs->trans('AmountTTC').'</td>'; | 
                                                        |
| 3612 | + print '<td class="nowrap amountcard right">'.price($object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency).'</td>';  | 
                                                        |
| 3613 | 3613 |  			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { | 
                                                        
| 3614 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';  | 
                                                        |
| 3614 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';  | 
                                                        |
| 3615 | 3615 | }  | 
                                                        
| 3616 | 3616 | print '</tr>';  | 
                                                        
| 3617 | 3617 | |
@@ -4155,7 +4155,7 @@ discard block  | 
                                                    ||
| 4155 | 4155 | }  | 
                                                        
| 4156 | 4156 | |
| 4157 | 4157 | // Clone as predefined / Create template  | 
                                                        
| 4158 | -				if (($object->type ==  FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->status == 0 && $usercancreate) { | 
                                                        |
| 4158 | +				if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->status == 0 && $usercancreate) { | 
                                                        |
| 4159 | 4159 |  					if (!$objectidnext && count($object->lines) > 0) { | 
                                                        
| 4160 | 4160 |  						print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>'; | 
                                                        
| 4161 | 4161 | }  | 
                                                        
@@ -216,7 +216,7 @@ discard block  | 
                                                    ||
| 216 | 216 | /**  | 
                                                        
| 217 | 217 | * @var int ID  | 
                                                        
| 218 | 218 | */  | 
                                                        
| 219 | - public $fk_account; // default bank account  | 
                                                        |
| 219 | + public $fk_account; // default bank account  | 
                                                        |
| 220 | 220 | |
| 221 | 221 | /**  | 
                                                        
| 222 | 222 | * @var int Transport mode id  | 
                                                        
@@ -408,7 +408,7 @@ discard block  | 
                                                    ||
| 408 | 408 |  		if ($this->fac_rec > 0) { | 
                                                        
| 409 | 409 | $this->fk_fac_rec_source = $this->fac_rec;  | 
                                                        
| 410 | 410 | |
| 411 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture-rec.class.php';  | 
                                                        |
| 411 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture-rec.class.php';  | 
                                                        |
| 412 | 412 | $_facrec = new FactureFournisseurRec($this->db);  | 
                                                        
| 413 | 413 | $result = $_facrec->fetch($this->fac_rec);  | 
                                                        
| 414 | 414 | $result = $_facrec->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); // This load $_facrec->linkedObjectsIds  | 
                                                        
@@ -443,13 +443,13 @@ discard block  | 
                                                    ||
| 443 | 443 | $this->location_incoterms = $_facrec->location_incoterms;  | 
                                                        
| 444 | 444 | |
| 445 | 445 | // Clean parameters  | 
                                                        
| 446 | -			if (! $this->type) { | 
                                                        |
| 446 | +			if (!$this->type) { | 
                                                        |
| 447 | 447 | $this->type = self::TYPE_STANDARD;  | 
                                                        
| 448 | 448 | }  | 
                                                        
| 449 | 449 |  			if (!empty(GETPOST('ref_supplier'))) { | 
                                                        
| 450 | 450 | $this->ref_supplier = trim($this->ref_supplier);  | 
                                                        
| 451 | 451 |  			} else { | 
                                                        
| 452 | - $this->ref_supplier = trim($this->ref_supplier . '_' . ($_facrec->nb_gen_done + 1));  | 
                                                        |
| 452 | + $this->ref_supplier = trim($this->ref_supplier.'_'.($_facrec->nb_gen_done + 1));  | 
                                                        |
| 453 | 453 | }  | 
                                                        
| 454 | 454 | $this->note_public = trim($this->note_public);  | 
                                                        
| 455 | 455 | $this->note_private = trim($this->note_private);  | 
                                                        
@@ -457,11 +457,11 @@ discard block  | 
                                                    ||
| 457 | 457 | |
| 458 | 458 | $this->array_options = $_facrec->array_options;  | 
                                                        
| 459 | 459 | |
| 460 | -			if (! $this->mode_reglement_id) { | 
                                                        |
| 460 | +			if (!$this->mode_reglement_id) { | 
                                                        |
| 461 | 461 | $this->mode_reglement_id = 0;  | 
                                                        
| 462 | 462 | }  | 
                                                        
| 463 | 463 | $this->status = self::STATUS_DRAFT;  | 
                                                        
| 464 | - $this->statut = self::STATUS_DRAFT; // deprecated  | 
                                                        |
| 464 | + $this->statut = self::STATUS_DRAFT; // deprecated  | 
                                                        |
| 465 | 465 | |
| 466 | 466 | $this->linked_objects = $_facrec->linkedObjectsIds;  | 
                                                        
| 467 | 467 | // We do not add link to template invoice or next invoice will be linked to all generated invoices  | 
                                                        
@@ -709,7 +709,7 @@ discard block  | 
                                                    ||
| 709 | 709 | /*  | 
                                                        
| 710 | 710 | * Insert lines of template invoices  | 
                                                        
| 711 | 711 | */  | 
                                                        
| 712 | -			if (! $error && $this->fac_rec > 0) { | 
                                                        |
| 712 | +			if (!$error && $this->fac_rec > 0) { | 
                                                        |
| 713 | 713 |  				foreach ($_facrec->lines as $i => $val) { | 
                                                        
| 714 | 714 |  					if ($_facrec->lines[$i]->fk_product) { | 
                                                        
| 715 | 715 | $prod = new Product($this->db);  | 
                                                        
@@ -724,7 +724,7 @@ discard block  | 
                                                    ||
| 724 | 724 | $localtax1_tx=get_localtax($tva_tx,1,$soc,$mysoc,$tva_npr);  | 
                                                        
| 725 | 725 | $localtax2_tx=get_localtax($tva_tx,2,$soc,$mysoc,$tva_npr);  | 
                                                        
| 726 | 726 | */  | 
                                                        
| 727 | -					$tva_tx = $_facrec->lines[$i]->tva_tx . ($_facrec->lines[$i]->vat_src_code ? '(' . $_facrec->lines[$i]->vat_src_code . ')' : ''); | 
                                                        |
| 727 | +					$tva_tx = $_facrec->lines[$i]->tva_tx.($_facrec->lines[$i]->vat_src_code ? '('.$_facrec->lines[$i]->vat_src_code.')' : ''); | 
                                                        |
| 728 | 728 | $tva_npr = $_facrec->lines[$i]->info_bits;  | 
                                                        
| 729 | 729 |  					if (empty($tva_tx)) { | 
                                                        
| 730 | 730 | $tva_npr = 0;  | 
                                                        
@@ -736,8 +736,8 @@ discard block  | 
                                                    ||
| 736 | 736 | $buyprice = empty($_facrec->lines[$i]->buyprice) ? 0 : $_facrec->lines[$i]->buyprice;  | 
                                                        
| 737 | 737 | |
| 738 | 738 | // If buyprice not defined from template invoice, we try to guess the best value  | 
                                                        
| 739 | -					if (! $buyprice && $_facrec->lines[$i]->fk_product > 0) { | 
                                                        |
| 740 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';  | 
                                                        |
| 739 | +					if (!$buyprice && $_facrec->lines[$i]->fk_product > 0) { | 
                                                        |
| 740 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';  | 
                                                        |
| 741 | 741 | $producttmp = new ProductFournisseur($this->db);  | 
                                                        
| 742 | 742 | $producttmp->fetch($_facrec->lines[$i]->fk_product);  | 
                                                        
| 743 | 743 | |
@@ -923,11 +923,11 @@ discard block  | 
                                                    ||
| 923 | 923 | $this->id = $obj->rowid;  | 
                                                        
| 924 | 924 | $this->ref = $obj->ref ? $obj->ref : $obj->rowid; // We take rowid if ref is empty for backward compatibility  | 
                                                        
| 925 | 925 | |
| 926 | - $this->ref_supplier = $obj->ref_supplier;  | 
                                                        |
| 927 | - $this->ref_ext = $obj->ref_ext;  | 
                                                        |
| 928 | - $this->entity = $obj->entity;  | 
                                                        |
| 926 | + $this->ref_supplier = $obj->ref_supplier;  | 
                                                        |
| 927 | + $this->ref_ext = $obj->ref_ext;  | 
                                                        |
| 928 | + $this->entity = $obj->entity;  | 
                                                        |
| 929 | 929 | $this->type = empty($obj->type) ? self::TYPE_STANDARD : $obj->type;  | 
                                                        
| 930 | - $this->subtype = (int) $obj->subtype;  | 
                                                        |
| 930 | + $this->subtype = (int) $obj->subtype;  | 
                                                        |
| 931 | 931 | $this->socid = $obj->fk_soc;  | 
                                                        
| 932 | 932 | $this->datec = $this->db->jdate($obj->datec);  | 
                                                        
| 933 | 933 | $this->date = $this->db->jdate($obj->datef);  | 
                                                        
@@ -945,13 +945,13 @@ discard block  | 
                                                    ||
| 945 | 945 | $this->total_tva = $obj->total_tva;  | 
                                                        
| 946 | 946 | $this->total_ttc = $obj->total_ttc;  | 
                                                        
| 947 | 947 | $this->status = $obj->status;  | 
                                                        
| 948 | - $this->statut = $obj->status; // For backward compatibility  | 
                                                        |
| 949 | - $this->fk_statut = $obj->status; // For backward compatibility  | 
                                                        |
| 948 | + $this->statut = $obj->status; // For backward compatibility  | 
                                                        |
| 949 | + $this->fk_statut = $obj->status; // For backward compatibility  | 
                                                        |
| 950 | 950 | $this->user_creation_id = $obj->fk_user_author;  | 
                                                        
| 951 | - $this->author = $obj->fk_user_author; // deprecated  | 
                                                        |
| 951 | + $this->author = $obj->fk_user_author; // deprecated  | 
                                                        |
| 952 | 952 | $this->user_validation_id = $obj->fk_user_valid;  | 
                                                        
| 953 | 953 | $this->fk_facture_source = $obj->fk_facture_source;  | 
                                                        
| 954 | - $this->vat_reverse_charge = empty($obj->vat_reverse_charge) ? 0 : 1;  | 
                                                        |
| 954 | + $this->vat_reverse_charge = empty($obj->vat_reverse_charge) ? 0 : 1;  | 
                                                        |
| 955 | 955 | $this->fk_fac_rec_source = $obj->fk_fac_rec_source;  | 
                                                        
| 956 | 956 | $this->fk_project = $obj->fk_project;  | 
                                                        
| 957 | 957 | $this->cond_reglement_id = $obj->fk_cond_reglement;  | 
                                                        
@@ -987,7 +987,7 @@ discard block  | 
                                                    ||
| 987 | 987 | |
| 988 | 988 | $this->extraparams = isset($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array();  | 
                                                        
| 989 | 989 | |
| 990 | - $this->socid = $obj->socid;  | 
                                                        |
| 990 | + $this->socid = $obj->socid;  | 
                                                        |
| 991 | 991 | |
| 992 | 992 | // Retrieve all extrafield  | 
                                                        
| 993 | 993 | // fetch optionals attributes and labels  | 
                                                        
@@ -1054,11 +1054,11 @@ discard block  | 
                                                    ||
| 1054 | 1054 | $line->date_end = $obj->date_end;  | 
                                                        
| 1055 | 1055 | $line->product_ref = $obj->product_ref;  | 
                                                        
| 1056 | 1056 | $line->ref = $obj->product_ref;  | 
                                                        
| 1057 | - $line->ref_supplier = $obj->ref_supplier;  | 
                                                        |
| 1057 | + $line->ref_supplier = $obj->ref_supplier;  | 
                                                        |
| 1058 | 1058 | $line->libelle = $obj->label;  | 
                                                        
| 1059 | 1059 | $line->label = $obj->label;  | 
                                                        
| 1060 | 1060 | $line->product_barcode = $obj->product_barcode;  | 
                                                        
| 1061 | - $line->product_desc = $obj->product_desc;  | 
                                                        |
| 1061 | + $line->product_desc = $obj->product_desc;  | 
                                                        |
| 1062 | 1062 | $line->subprice = $obj->pu_ht;  | 
                                                        
| 1063 | 1063 | $line->pu_ht = $obj->pu_ht;  | 
                                                        
| 1064 | 1064 | $line->pu_ttc = $obj->pu_ttc;  | 
                                                        
@@ -1068,7 +1068,7 @@ discard block  | 
                                                    ||
| 1068 | 1068 | $line->localtax2_tx = $obj->localtax2_tx;  | 
                                                        
| 1069 | 1069 | $line->localtax1_type = $obj->localtax1_type;  | 
                                                        
| 1070 | 1070 | $line->localtax2_type = $obj->localtax2_type;  | 
                                                        
| 1071 | - $line->qty = $obj->qty;  | 
                                                        |
| 1071 | + $line->qty = $obj->qty;  | 
                                                        |
| 1072 | 1072 | $line->remise_percent = $obj->remise_percent;  | 
                                                        
| 1073 | 1073 | $line->fk_remise_except = $obj->fk_remise_except;  | 
                                                        
| 1074 | 1074 | //$line->tva = $obj->total_tva; // deprecated  | 
                                                        
@@ -2713,7 +2713,7 @@ discard block  | 
                                                    ||
| 2713 | 2713 | |
| 2714 | 2714 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 2715 | 2715 | $facturestatic->date_echeance = $this->db->jdate($obj->datefin);  | 
                                                        
| 2716 | - $facturestatic->statut = $obj->status; // For backward compatibility  | 
                                                        |
| 2716 | + $facturestatic->statut = $obj->status; // For backward compatibility  | 
                                                        |
| 2717 | 2717 | $facturestatic->status = $obj->status;  | 
                                                        
| 2718 | 2718 | |
| 2719 | 2719 | $response->nbtodo++;  | 
                                                        
@@ -2924,7 +2924,7 @@ discard block  | 
                                                    ||
| 2924 | 2924 | }  | 
                                                        
| 2925 | 2925 | }  | 
                                                        
| 2926 | 2926 | global $action;  | 
                                                        
| 2927 | - $hookmanager->initHooks(array($this->element . 'dao'));  | 
                                                        |
| 2927 | + $hookmanager->initHooks(array($this->element.'dao'));  | 
                                                        |
| 2928 | 2928 |  		$parameters = array('id' => $this->id, 'getnomurl' => &$result); | 
                                                        
| 2929 | 2929 |  		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks | 
                                                        
| 2930 | 2930 |  		if ($reshook > 0) { | 
                                                        
@@ -2955,7 +2955,7 @@ discard block  | 
                                                    ||
| 2955 | 2955 | |
| 2956 | 2956 | $mybool = false;  | 
                                                        
| 2957 | 2957 | |
| 2958 | -		$file = getDolGlobalString('INVOICE_SUPPLIER_ADDON_NUMBER') . ".php"; | 
                                                        |
| 2958 | +		$file = getDolGlobalString('INVOICE_SUPPLIER_ADDON_NUMBER').".php"; | 
                                                        |
| 2959 | 2959 |  		$classname = getDolGlobalString('INVOICE_SUPPLIER_ADDON_NUMBER'); | 
                                                        
| 2960 | 2960 | |
| 2961 | 2961 | // Include file with class  | 
                                                        
@@ -3145,7 +3145,7 @@ discard block  | 
                                                    ||
| 3145 | 3145 | // Load source object  | 
                                                        
| 3146 | 3146 | $object->fetch($fromid);  | 
                                                        
| 3147 | 3147 | $object->id = 0;  | 
                                                        
| 3148 | - $object->statut = self::STATUS_DRAFT; // For backward compatibility  | 
                                                        |
| 3148 | + $object->statut = self::STATUS_DRAFT; // For backward compatibility  | 
                                                        |
| 3149 | 3149 | $object->status = self::STATUS_DRAFT;  | 
                                                        
| 3150 | 3150 | |
| 3151 | 3151 | $object->fetch_thirdparty(); // We need it to recalculate VAT localtaxes according to main sale taxes and vendor  | 
                                                        
@@ -3445,14 +3445,14 @@ discard block  | 
                                                    ||
| 3445 | 3445 |  		if (!empty($paymentmode) && $paymentmode != 'all') { | 
                                                        
| 3446 | 3446 | $sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";  | 
                                                        
| 3447 | 3447 | }  | 
                                                        
| 3448 | - $sql .= " WHERE f.paye = 0"; // Only unpaid  | 
                                                        |
| 3449 | - $sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status  | 
                                                        |
| 3448 | + $sql .= " WHERE f.paye = 0"; // Only unpaid  | 
                                                        |
| 3449 | + $sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status  | 
                                                        |
| 3450 | 3450 |  		if ($datetouse == 'invoicedate') { | 
                                                        
| 3451 | 3451 | $sql .= " AND f.datef = '".$this->db->idate($tmpidate, 'gmt')."'";  | 
                                                        
| 3452 | 3452 |  		} else { | 
                                                        
| 3453 | 3453 | $sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";  | 
                                                        
| 3454 | 3454 | }  | 
                                                        
| 3455 | -		$sql .= " AND f.entity IN (".getEntity('supplier_invoice', 0).")";	// One batch process only one company (no sharing) | 
                                                        |
| 3455 | +		$sql .= " AND f.entity IN (".getEntity('supplier_invoice', 0).")"; // One batch process only one company (no sharing) | 
                                                        |
| 3456 | 3456 |  		if (!empty($paymentmode) && $paymentmode != 'all') { | 
                                                        
| 3457 | 3457 | $sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'";  | 
                                                        
| 3458 | 3458 | }  | 
                                                        
@@ -3672,7 +3672,7 @@ discard block  | 
                                                    ||
| 3672 | 3672 | $actioncomm->create($user);  | 
                                                        
| 3673 | 3673 | }  | 
                                                        
| 3674 | 3674 | |
| 3675 | - $this->db->commit(); // We always commit  | 
                                                        |
| 3675 | + $this->db->commit(); // We always commit  | 
                                                        |
| 3676 | 3676 | }  | 
                                                        
| 3677 | 3677 | |
| 3678 | 3678 |  						if ($errormesg) { | 
                                                        
@@ -3981,11 +3981,11 @@ discard block  | 
                                                    ||
| 3981 | 3981 | $this->id = $obj->rowid;  | 
                                                        
| 3982 | 3982 | $this->rowid = $obj->rowid;  | 
                                                        
| 3983 | 3983 | $this->fk_facture_fourn = $obj->fk_facture_fourn;  | 
                                                        
| 3984 | - $this->description = $obj->line_desc;  | 
                                                        |
| 3985 | - $this->desc = $obj->line_desc;  | 
                                                        |
| 3984 | + $this->description = $obj->line_desc;  | 
                                                        |
| 3985 | + $this->desc = $obj->line_desc;  | 
                                                        |
| 3986 | 3986 | $this->date_start = $obj->date_start;  | 
                                                        
| 3987 | 3987 | $this->date_end = $obj->date_end;  | 
                                                        
| 3988 | - $this->product_ref = $obj->product_ref;  | 
                                                        |
| 3988 | + $this->product_ref = $obj->product_ref;  | 
                                                        |
| 3989 | 3989 | $this->ref_supplier = $obj->ref_supplier;  | 
                                                        
| 3990 | 3990 | $this->product_desc = $obj->product_desc;  | 
                                                        
| 3991 | 3991 | |
@@ -3998,7 +3998,7 @@ discard block  | 
                                                    ||
| 3998 | 3998 | $this->localtax1_type = $obj->localtax1_type;  | 
                                                        
| 3999 | 3999 | $this->localtax2_type = $obj->localtax2_type;  | 
                                                        
| 4000 | 4000 | |
| 4001 | - $this->qty = $obj->qty;  | 
                                                        |
| 4001 | + $this->qty = $obj->qty;  | 
                                                        |
| 4002 | 4002 | $this->remise_percent = $obj->remise_percent;  | 
                                                        
| 4003 | 4003 | $this->fk_remise_except = $obj->fk_remise_except;  | 
                                                        
| 4004 | 4004 | //$this->tva = $obj->total_tva; // deprecated  | 
                                                        
@@ -285,12 +285,12 @@ discard block  | 
                                                    ||
| 285 | 285 | /*  | 
                                                        
| 286 | 286 | * No signature  | 
                                                        
| 287 | 287 | */  | 
                                                        
| 288 | - const STATUS_NO_SIGNATURE = 0;  | 
                                                        |
| 288 | + const STATUS_NO_SIGNATURE = 0;  | 
                                                        |
| 289 | 289 | |
| 290 | 290 | /*  | 
                                                        
| 291 | 291 | * Signed by sender  | 
                                                        
| 292 | 292 | */  | 
                                                        
| 293 | - const STATUS_SIGNED_SENDER = 1;  | 
                                                        |
| 293 | + const STATUS_SIGNED_SENDER = 1;  | 
                                                        |
| 294 | 294 | |
| 295 | 295 | /*  | 
                                                        
| 296 | 296 | * Signed by receiver  | 
                                                        
@@ -300,7 +300,7 @@ discard block  | 
                                                    ||
| 300 | 300 | /*  | 
                                                        
| 301 | 301 | * Signed by all  | 
                                                        
| 302 | 302 | */  | 
                                                        
| 303 | - const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract)  | 
                                                        |
| 303 | + const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract)  | 
                                                        |
| 304 | 304 | |
| 305 | 305 | |
| 306 | 306 | /**  | 
                                                        
@@ -327,7 +327,7 @@ discard block  | 
                                                    ||
| 327 | 327 |  		if (getDolGlobalString('CONTRACT_ADDON')) { | 
                                                        
| 328 | 328 | $mybool = false;  | 
                                                        
| 329 | 329 | |
| 330 | -			$file = getDolGlobalString('CONTRACT_ADDON') . ".php"; | 
                                                        |
| 330 | +			$file = getDolGlobalString('CONTRACT_ADDON').".php"; | 
                                                        |
| 331 | 331 |  			$classname = getDolGlobalString('CONTRACT_ADDON'); | 
                                                        
| 332 | 332 | |
| 333 | 333 | // Include file with class  | 
                                                        
@@ -437,7 +437,7 @@ discard block  | 
                                                    ||
| 437 | 437 |  			if ($contratline->statut != ContratLigne::STATUS_OPEN) { | 
                                                        
| 438 | 438 | $contratline->context = $this->context;  | 
                                                        
| 439 | 439 | |
| 440 | - $result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment); // This call trigger LINECONTRACT_ACTIVATE  | 
                                                        |
| 440 | + $result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment); // This call trigger LINECONTRACT_ACTIVATE  | 
                                                        |
| 441 | 441 |  				if ($result < 0) { | 
                                                        
| 442 | 442 | $error++;  | 
                                                        
| 443 | 443 | $this->error = $contratline->error;  | 
                                                        
@@ -487,7 +487,7 @@ discard block  | 
                                                    ||
| 487 | 487 | // Close lines not already closed  | 
                                                        
| 488 | 488 |  			if ($contratline->statut != ContratLigne::STATUS_CLOSED) { | 
                                                        
| 489 | 489 | $contratline->date_end_real = $now;  | 
                                                        
| 490 | - $contratline->date_cloture = $now; // For backward compatibility  | 
                                                        |
| 490 | + $contratline->date_cloture = $now; // For backward compatibility  | 
                                                        |
| 491 | 491 | $contratline->user_closing_id = $user->id;  | 
                                                        
| 492 | 492 | $contratline->statut = ContratLigne::STATUS_CLOSED;  | 
                                                        
| 493 | 493 | $result = $contratline->close_line($user, $now, $comment, $notrigger);  | 
                                                        
@@ -626,7 +626,7 @@ discard block  | 
                                                    ||
| 626 | 626 |  			if (!$error) { | 
                                                        
| 627 | 627 | $this->ref = $num;  | 
                                                        
| 628 | 628 | $this->status = self::STATUS_VALIDATED;  | 
                                                        
| 629 | - $this->statut = self::STATUS_VALIDATED; // deprecated  | 
                                                        |
| 629 | + $this->statut = self::STATUS_VALIDATED; // deprecated  | 
                                                        |
| 630 | 630 | $this->date_validation = $now;  | 
                                                        
| 631 | 631 | }  | 
                                                        
| 632 | 632 |  		} else { | 
                                                        
@@ -896,10 +896,10 @@ discard block  | 
                                                    ||
| 896 | 896 | $line->localtax2_tx = $objp->localtax2_tx;  | 
                                                        
| 897 | 897 | $line->localtax1_type = $objp->localtax1_type;  | 
                                                        
| 898 | 898 | $line->localtax2_type = $objp->localtax2_type;  | 
                                                        
| 899 | - $line->subprice = $objp->subprice;  | 
                                                        |
| 899 | + $line->subprice = $objp->subprice;  | 
                                                        |
| 900 | 900 | $line->statut = $objp->status;  | 
                                                        
| 901 | 901 | $line->status = $objp->status;  | 
                                                        
| 902 | - $line->remise_percent = $objp->remise_percent;  | 
                                                        |
| 902 | + $line->remise_percent = $objp->remise_percent;  | 
                                                        |
| 903 | 903 | $line->price_ht = $objp->price_ht;  | 
                                                        
| 904 | 904 | $line->price = $objp->price_ht; // For backward compatibility  | 
                                                        
| 905 | 905 | $line->total_ht = $objp->total_ht;  | 
                                                        
@@ -942,7 +942,7 @@ discard block  | 
                                                    ||
| 942 | 942 | //$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);  | 
                                                        
| 943 | 943 | //$line->date_fin_reel = $this->db->jdate($objp->date_cloture);  | 
                                                        
| 944 | 944 | |
| 945 | - $line->rang = $objp->rang;  | 
                                                        |
| 945 | + $line->rang = $objp->rang;  | 
                                                        |
| 946 | 946 | |
| 947 | 947 | // Retrieve all extrafields for contract line  | 
                                                        
| 948 | 948 | // fetch optionals attributes and labels  | 
                                                        
@@ -1455,7 +1455,7 @@ discard block  | 
                                                    ||
| 1455 | 1455 | }  | 
                                                        
| 1456 | 1456 | |
| 1457 | 1457 |  		if (!$error) { | 
                                                        
| 1458 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields  | 
                                                        |
| 1458 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields  | 
                                                        |
| 1459 | 1459 |  			if ($result < 0) { | 
                                                        
| 1460 | 1460 | $error++;  | 
                                                        
| 1461 | 1461 | }  | 
                                                        
@@ -2091,7 +2091,7 @@ discard block  | 
                                                    ||
| 2091 | 2091 | }  | 
                                                        
| 2092 | 2092 |  				$datas['customer'] = '<br><b>'.$langs->trans('Customer').':</b> '.$this->thirdparty->getNomUrl(1, '', 0, 1); | 
                                                        
| 2093 | 2093 | }  | 
                                                        
| 2094 | -			$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '. $this->ref_customer; | 
                                                        |
| 2094 | +			$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_customer; | 
                                                        |
| 2095 | 2095 |  			if (!$nofetch) { | 
                                                        
| 2096 | 2096 |  				$langs->load('project'); | 
                                                        
| 2097 | 2097 |  				if (empty($this->project) && $this->project instanceof Project) { | 
                                                        
@@ -2559,7 +2559,7 @@ discard block  | 
                                                    ||
| 2559 | 2559 | global $user;  | 
                                                        
| 2560 | 2560 | |
| 2561 | 2561 | $ticket = new Ticket($this->db);  | 
                                                        
| 2562 | -		$nbTicket =  $ticket->fetchAll($user, 'ASC', 't.datec', '', 0, '', array('t.fk_contract' => $this->id)); | 
                                                        |
| 2562 | +		$nbTicket = $ticket->fetchAll($user, 'ASC', 't.datec', '', 0, '', array('t.fk_contract' => $this->id)); | 
                                                        |
| 2563 | 2563 | |
| 2564 | 2564 | return ($nbTicket < 0 ? $nbTicket : $ticket->lines);  | 
                                                        
| 2565 | 2565 | }  | 
                                                        
@@ -2581,7 +2581,7 @@ discard block  | 
                                                    ||
| 2581 | 2581 | global $conf, $langs;  | 
                                                        
| 2582 | 2582 | |
| 2583 | 2583 |  		if (!dol_strlen($modele)) { | 
                                                        
| 2584 | - $modele = ''; // No doc template/generation by default  | 
                                                        |
| 2584 | + $modele = ''; // No doc template/generation by default  | 
                                                        |
| 2585 | 2585 | |
| 2586 | 2586 |  			if (!empty($this->model_pdf)) { | 
                                                        
| 2587 | 2587 | $modele = $this->model_pdf;  | 
                                                        
@@ -2678,14 +2678,14 @@ discard block  | 
                                                    ||
| 2678 | 2678 | }  | 
                                                        
| 2679 | 2679 | }  | 
                                                        
| 2680 | 2680 | |
| 2681 | -		if (!getDolGlobalString('CONTRACT_ADDON') || !is_readable(DOL_DOCUMENT_ROOT."/core/modules/contract/" . getDolGlobalString('CONTRACT_ADDON').".php")) { | 
                                                        |
| 2681 | +		if (!getDolGlobalString('CONTRACT_ADDON') || !is_readable(DOL_DOCUMENT_ROOT."/core/modules/contract/".getDolGlobalString('CONTRACT_ADDON').".php")) { | 
                                                        |
| 2682 | 2682 | $this->error = 'ErrorSetupNotComplete';  | 
                                                        
| 2683 | 2683 | dol_syslog($this->error);  | 
                                                        
| 2684 | 2684 | return -1;  | 
                                                        
| 2685 | 2685 | }  | 
                                                        
| 2686 | 2686 | |
| 2687 | 2687 | // Set ref  | 
                                                        
| 2688 | -		require_once DOL_DOCUMENT_ROOT."/core/modules/contract/" . getDolGlobalString('CONTRACT_ADDON').'.php'; | 
                                                        |
| 2688 | +		require_once DOL_DOCUMENT_ROOT."/core/modules/contract/".getDolGlobalString('CONTRACT_ADDON').'.php'; | 
                                                        |
| 2689 | 2689 |  		$obj = getDolGlobalString('CONTRACT_ADDON'); | 
                                                        
| 2690 | 2690 | $modContract = new $obj();  | 
                                                        
| 2691 | 2691 | '@phan-var-force CommonNumRefGenerator $modContrat';  | 
                                                        
@@ -2808,7 +2808,7 @@ discard block  | 
                                                    ||
| 2808 | 2808 | |
| 2809 | 2809 | // Load contract  | 
                                                        
| 2810 | 2810 | $object = new Contrat($this->db);  | 
                                                        
| 2811 | - $object->fetch($obj->rowid); // fetch also lines  | 
                                                        |
| 2811 | + $object->fetch($obj->rowid); // fetch also lines  | 
                                                        |
| 2812 | 2812 | //$object->fetch_thirdparty();  | 
                                                        
| 2813 | 2813 | |
| 2814 | 2814 |  					if ($object->id <= 0) { | 
                                                        
@@ -2855,7 +2855,7 @@ discard block  | 
                                                    ||
| 2855 | 2855 |  					if ($expirationdate && $expirationdate < $enddatetoscan) { | 
                                                        
| 2856 | 2856 |  						dol_syslog("Define the newdate of end of services from expirationdate=".$expirationdate); | 
                                                        
| 2857 | 2857 | $newdate = $expirationdate;  | 
                                                        
| 2858 | - $protecti = 0; //$protecti is to avoid infinite loop  | 
                                                        |
| 2858 | + $protecti = 0; //$protecti is to avoid infinite loop  | 
                                                        |
| 2859 | 2859 |  						while ($newdate < $enddatetoscan && $protecti < 1000) { | 
                                                        
| 2860 | 2860 | $newdate = dol_time_plus_duree($newdate, $duration_value, $duration_unit);  | 
                                                        
| 2861 | 2861 | $protecti++;  | 
                                                        
@@ -2883,20 +2883,20 @@ discard block  | 
                                                    ||
| 2883 | 2883 | |
| 2884 | 2884 | // Create an event  | 
                                                        
| 2885 | 2885 | $actioncomm = new ActionComm($this->db);  | 
                                                        
| 2886 | -								$actioncomm->type_code    = 'AC_OTH_AUTO';		// Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) | 
                                                        |
| 2886 | +								$actioncomm->type_code    = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) | 
                                                        |
| 2887 | 2887 | $actioncomm->code = 'AC_'.$actioncode;  | 
                                                        
| 2888 | 2888 | $actioncomm->label = $label;  | 
                                                        
| 2889 | 2889 | $actioncomm->datep = $now;  | 
                                                        
| 2890 | 2890 | $actioncomm->datef = $now;  | 
                                                        
| 2891 | - $actioncomm->percentage = -1; // Not applicable  | 
                                                        |
| 2891 | + $actioncomm->percentage = -1; // Not applicable  | 
                                                        |
| 2892 | 2892 | $actioncomm->socid = $object->socid;  | 
                                                        
| 2893 | - $actioncomm->authorid = $user->id; // User saving action  | 
                                                        |
| 2894 | - $actioncomm->userownerid = $user->id; // Owner of action  | 
                                                        |
| 2893 | + $actioncomm->authorid = $user->id; // User saving action  | 
                                                        |
| 2894 | + $actioncomm->userownerid = $user->id; // Owner of action  | 
                                                        |
| 2895 | 2895 | $actioncomm->fk_element = $object->id;  | 
                                                        
| 2896 | 2896 | $actioncomm->elementtype = 'contract';  | 
                                                        
| 2897 | 2897 | $actioncomm->note_private = $comment;  | 
                                                        
| 2898 | 2898 | |
| 2899 | - $ret = $actioncomm->create($user); // User creating action  | 
                                                        |
| 2899 | + $ret = $actioncomm->create($user); // User creating action  | 
                                                        |
| 2900 | 2900 |  							} else { | 
                                                        
| 2901 | 2901 | $contracterror[$object->id] = $object->ref;  | 
                                                        
| 2902 | 2902 | |
@@ -2905,7 +2905,7 @@ discard block  | 
                                                    ||
| 2905 | 2905 | $this->error = $this->db->lasterror();  | 
                                                        
| 2906 | 2906 | }  | 
                                                        
| 2907 | 2907 | |
| 2908 | -							if (! $errorforlocaltransaction) { | 
                                                        |
| 2908 | +							if (!$errorforlocaltransaction) { | 
                                                        |
| 2909 | 2909 | $this->db->commit();  | 
                                                        
| 2910 | 2910 |  							} else { | 
                                                        
| 2911 | 2911 | $this->db->rollback();  | 
                                                        
@@ -213,10 +213,10 @@ discard block  | 
                                                    ||
| 213 | 213 | print '</tr></table>';  | 
                                                        
| 214 | 214 | print '</td>';  | 
                                                        
| 215 | 215 | |
| 216 | - $cssview = !empty($extrafields->attributes[$object->table_element]['cssview'][$tmpkeyextra]) ? ($extrafields->attributes[$object->table_element]['cssview'][$tmpkeyextra] . ' ') : '';  | 
                                                        |
| 216 | + $cssview = !empty($extrafields->attributes[$object->table_element]['cssview'][$tmpkeyextra]) ? ($extrafields->attributes[$object->table_element]['cssview'][$tmpkeyextra].' ') : '';  | 
                                                        |
| 217 | 217 | $html_id = !empty($object->id) ? $object->element.'_extras_'.$tmpkeyextra.'_'.$object->id : '';  | 
                                                        
| 218 | 218 | |
| 219 | - print '<td id="' . $html_id . '" class="valuefield ' . $cssview . $object->element . '_extras_' . $tmpkeyextra . ' wordbreakimp"' . (!empty($cols) ? ' colspan="' . $cols . '"' : '') . '>';  | 
                                                        |
| 219 | + print '<td id="'.$html_id.'" class="valuefield '.$cssview.$object->element.'_extras_'.$tmpkeyextra.' wordbreakimp"'.(!empty($cols) ? ' colspan="'.$cols.'"' : '').'>';  | 
                                                        |
| 220 | 220 | |
| 221 | 221 | // Convert date into timestamp format  | 
                                                        
| 222 | 222 |  			if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('date'))) { | 
                                                        
@@ -244,7 +244,7 @@ discard block  | 
                                                    ||
| 244 | 244 |  				if ($object->table_element == 'societe') { | 
                                                        
| 245 | 245 | $fieldid = 'socid';  | 
                                                        
| 246 | 246 | }  | 
                                                        
| 247 | - print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"] . '?' . $fieldid . '=' . $object->id . '" method="post" name="formextra">';  | 
                                                        |
| 247 | + print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'?'.$fieldid.'='.$object->id.'" method="post" name="formextra">';  | 
                                                        |
| 248 | 248 | print '<input type="hidden" name="action" value="update_extras">';  | 
                                                        
| 249 | 249 | print '<input type="hidden" name="attribute" value="'.$tmpkeyextra.'">';  | 
                                                        
| 250 | 250 | print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
@@ -282,11 +282,11 @@ discard block  | 
                                                    ||
| 282 | 282 | $reg = array();  | 
                                                        
| 283 | 283 |  			$fromtype = GETPOST('fromtype', 'alpha'); | 
                                                        
| 284 | 284 |  			if ($fromtype === 'robot') { | 
                                                        
| 285 | -				$from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM').'>'; | 
                                                        |
| 285 | +				$from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <'.getDolGlobalString('MAIN_MAIL_EMAIL_FROM').'>'; | 
                                                        |
| 286 | 286 |  			} elseif ($fromtype === 'user') { | 
                                                        
| 287 | 287 |  				$from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>'; | 
                                                        
| 288 | 288 |  			} elseif ($fromtype === 'company') { | 
                                                        
| 289 | -				$from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; | 
                                                        |
| 289 | +				$from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; | 
                                                        |
| 290 | 290 |  			} elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { | 
                                                        
| 291 | 291 |  				$tmp = explode(',', $user->email_aliases); | 
                                                        
| 292 | 292 | $from = trim($tmp[($reg[1] - 1)]);  | 
                                                        
@@ -328,7 +328,7 @@ discard block  | 
                                                    ||
| 328 | 328 | // Autocomplete the $sendtobcc  | 
                                                        
| 329 | 329 | // $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO...  | 
                                                        
| 330 | 330 |  			if (!empty($autocopy)) { | 
                                                        
| 331 | - $sendtobcc .= (empty($conf->global->$autocopy) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString($autocopy)));  | 
                                                        |
| 331 | + $sendtobcc .= (empty($conf->global->$autocopy) ? '' : (($sendtobcc ? ", " : "").getDolGlobalString($autocopy)));  | 
                                                        |
| 332 | 332 | }  | 
                                                        
| 333 | 333 | |
| 334 | 334 |  			$deliveryreceipt = GETPOST('deliveryreceipt'); | 
                                                        
@@ -397,7 +397,7 @@ discard block  | 
                                                    ||
| 397 | 397 | $object->actionmsg = $message; // Long text  | 
                                                        
| 398 | 398 |  						$object->actionmsg2 = $actionmsg2; // Short text ($langs->transnoentities('MailSentByTo')...); | 
                                                        
| 399 | 399 |  						if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) { | 
                                                        
| 400 | - $object->actionmsg2 = $subject; // Short text  | 
                                                        |
| 400 | + $object->actionmsg2 = $subject; // Short text  | 
                                                        |
| 401 | 401 | }  | 
                                                        
| 402 | 402 | |
| 403 | 403 | $object->trackid = $trackid;  |