diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 1463d3ae8c7..3be285674b5 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -5,7 +5,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2017 Frédéric France + * Copyright (C) 2017-2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,11 +50,11 @@ $main_option = array ( $configuration = AccountancyExport::getTypeConfig(); -$listparam = $configuration[param]; +$listparam = $configuration['param']; -$listformat = $configuration[format]; +$listformat = $configuration['format']; -$listcr = $configuration[cr]; +$listcr = $configuration['cr']; $model_option = array ( @@ -117,7 +117,7 @@ if ($action == 'update') { if (! $error) { // reload $configuration = AccountancyExport::getTypeConfig(); - $listparam = $configuration[param]; + $listparam = $configuration['param']; setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); @@ -142,27 +142,27 @@ print ' {'."\n"; foreach ($listparam as $key => $param) { print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n"; print ' {'."\n"; - print ' //console.log("'.$param[label].'");'."\n"; - if (empty($param[ACCOUNTING_EXPORT_FORMAT])) { + print ' //console.log("'.$param['label'].'");'."\n"; + if (empty($param['ACCOUNTING_EXPORT_FORMAT'])) { print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n"; } else { - print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param[ACCOUNTING_EXPORT_FORMAT].'");'."\n"; + print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param['ACCOUNTING_EXPORT_FORMAT'].'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n"; } - if (empty($param[ACCOUNTING_EXPORT_SEPARATORCSV])) { + if (empty($param['ACCOUNTING_EXPORT_SEPARATORCSV'])) { print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n"; } else { print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n"; } - if (empty($param[ACCOUNTING_EXPORT_ENDLINE])) { + if (empty($param['ACCOUNTING_EXPORT_ENDLINE'])) { print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n"; } else { print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n"; } - if (empty($param[ACCOUNTING_EXPORT_DATE])) { + if (empty($param['ACCOUNTING_EXPORT_DATE'])) { print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n"; } else { @@ -257,15 +257,15 @@ if ($num2) { print ''; // Param - $label = $key[label]; + $label = $key['label']; print '' . $langs->trans($label) . ''; // Value print ''; - if (is_array($key[param])) { - print $form->selectarray($label, $key[param], $conf->global->$label, 0); + if (is_array($key['param'])) { + print $form->selectarray($label, $key['param'], $conf->global->$label, 0); } else { - print ''; + print ''; } print ''; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index bc09ac2c250..d7060124ee4 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -209,7 +209,7 @@ if (empty($reshook)) } else { - setEventMessages($object->errors, $object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index b6bffd3d1bd..f7389e9fbbc 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -75,7 +75,7 @@ if ($action == 'dolibarr2ldap') setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs'); } else { - setEventMessages($ldap->errors, $ldap->error, 'errors'); + setEventMessages($ldap->error, $ldap->errors, 'errors'); } } diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 2e62f6f49e7..858422c598c 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -160,7 +160,7 @@ print '
'; print ''; print ''; print " \n"; -print " \n"; +print " \n"; print ''."\n"; $found=0; @@ -262,7 +262,7 @@ print '
'; print '
".$langs->trans("RuleForStockManagementDecrease")."  
'; print ''; print " \n"; -print " \n"; +print " \n"; print ''."\n"; $found=0; @@ -341,7 +341,7 @@ print '
'; print '
".$langs->trans("RuleForStockManagementIncrease")."  
'; print ''; print " \n"; -print " \n"; +print " \n"; print ''."\n"; @@ -416,7 +416,7 @@ if ($virtualdiffersfromphysical) print '
".$langs->trans("RuleForStockAvailability")."  
'; print ''; print " \n"; - print " \n"; + print " \n"; print ''."\n"; print ''; @@ -439,12 +439,12 @@ print '
".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."  
'; print ''; print " \n"; -print " \n"; +print " \n"; print ''."\n"; print ''; print ''; -print '\n"; print ''; print ''; +print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")); +print ''; print ''; print ''."\n"; print ''; - print ''."\n"; + print ''."\n"; // Example with a yes / no select print ''; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 30dcd381ae2..7f5caa13031 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -40,7 +40,7 @@ if (! empty($conf->accounting->enabled)) { } // Load translation files required by the page -$langs->loadLangs(array('compta', 'bills')); +$langs->loadLangs(array('compta', 'bills', 'banks')); $id=GETPOST('id','int'); $action=GETPOST('action','aZ09'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index aa4f36acf15..ee72252281c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4984,7 +4984,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi * * @param int $idprod Id of product or 0 if not a predefined product * @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...) - * @param int $idprodfournprice Id product_fournisseur_price (for "supplier" order/invoice) + * @param int $idprodfournprice Id product_fournisseur_price (for "supplier" proposal/order/invoice) * @return float|string Vat rate to use with format 5.0 or '5.0 (XXX)' * @see get_product_localtax_for_country */ @@ -5005,7 +5005,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr if ($mysoc->country_code == $thirdparty_seller->country_code) // If selling country is ours { - if ($idprodfournprice > 0) // We want vat for product for a "supplier" order or invoice + if ($idprodfournprice > 0) // We want vat for product for a "supplier" object { $product->get_buyprice($idprodfournprice,0,0,0); $ret=$product->vatrate_supplier; @@ -5030,7 +5030,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr if (empty($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS)) { // If vat of product for the country not found or not defined, we return the first higher vat of country. - $sql = "SELECT taux as vat_rate"; + $sql = "SELECT t.taux as vat_rate, t.code as default_vat_code"; $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; $sql.= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'"; $sql.= " ORDER BY t.taux DESC, t.code ASC, t.recuperableonly ASC"; @@ -5043,6 +5043,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr if ($obj) { $ret=$obj->vat_rate; + if ($obj->default_vat_code) $ret.=' ('.$obj->default_vat_code.')'; } $db->free($sql); } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 877c519248b..5eaf345fe04 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -393,6 +393,48 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target // Web if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url); } + // Intra VAT + if (! empty($conf->global->MAIN_TVAINTRA_IN_SOURCE_ADDRESS)) + { + if ($sourcecompany->tva_intra) $stringaddress.=($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($sourcecompany->tva_intra); + } + // Professionnal Ids + if (! empty($conf->global->MAIN_PROFID1_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof1)) + { + $tmp=$outputlangs->transcountrynoentities("ProfId1",$sourcecompany->country_code); + if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1]; + $stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof1); + } + if (! empty($conf->global->MAIN_PROFID2_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof2)) + { + $tmp=$outputlangs->transcountrynoentities("ProfId2",$sourcecompany->country_code); + if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1]; + $stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof2); + } + if (! empty($conf->global->MAIN_PROFID3_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof3)) + { + $tmp=$outputlangs->transcountrynoentities("ProfId3",$sourcecompany->country_code); + if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1]; + $stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof3); + } + if (! empty($conf->global->MAIN_PROFID4_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof4)) + { + $tmp=$outputlangs->transcountrynoentities("ProfId4",$sourcecompany->country_code); + if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1]; + $stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof4); + } + if (! empty($conf->global->MAIN_PROFID5_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof5)) + { + $tmp=$outputlangs->transcountrynoentities("ProfId5",$sourcecompany->country_code); + if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1]; + $stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof5); + } + if (! empty($conf->global->MAIN_PROFID6_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof6)) + { + $tmp=$outputlangs->transcountrynoentities("ProfId6",$sourcecompany->country_code); + if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1]; + $stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof6); + } } if ($mode == 'target' || preg_match('/targetwithdetails/',$mode)) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 5b40ea235a6..fa91987e747 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -317,7 +317,7 @@ class modSociete extends DolibarrModules $this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '; if (! empty($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS)) { $subordinatesids = $user->getAllChildIds(); - $this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : ''; + $this->export_sql_end[$r] .=count($subordinatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subordinatesids).')' : ''; } $this->export_sql_end[$r] .=')'; } @@ -368,7 +368,7 @@ class modSociete extends DolibarrModules $this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '; if (! empty($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS)) { $subordinatesids = $user->getAllChildIds(); - $this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : ''; + $this->export_sql_end[$r] .=count($subordinatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subordinatesids).')' : ''; } $this->export_sql_end[$r] .=')'; } diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index fa4ad7b165a..00a58667f43 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -137,7 +137,7 @@ class InterfaceStripe $servicestatus = 1; } - // If customer is linked to Strip, we update/delete Stripe too + // If customer is linked to Stripe, we update/delete Stripe too if ($action == 'COMPANY_MODIFY') { dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); @@ -173,7 +173,8 @@ class InterfaceStripe $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this $customer = $stripe->customerStripe($object, $stripeacc, $servicestatus); - if ($customer) { + if ($customer) + { $customer->delete(); } @@ -182,7 +183,7 @@ class InterfaceStripe $this->db->query($sql); } - // If payment mode is linked to Strip, we update/delete Stripe too + // If payment mode is linked to Stripee, we update/delete Stripe too if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card') { // For creation of credit card, we do not create in Stripe automatically diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index f1fa3214e12..ea14b9aca90 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -513,9 +513,9 @@ if ($id > 0 || ! empty($ref)) { print ''; if (! empty($conf->productbatch->enabled)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } else { @@ -568,16 +568,21 @@ if ($id > 0 || ! empty($ref)) { if (! empty($conf->productbatch->enabled)) { if ($objp->tobatch) { - print '"; + print ''; + print ''; + print ''; } else { print '"; - print ''; + print ''; + print ''; } } else { print ''; print ''; // Supplier ref + Qty ordered + qty already dispatched } else { + $type = 'dispatch'; print ''; // Qty to dispatch @@ -713,21 +719,27 @@ if ($id > 0 || ! empty($ref)) { if ($nbproduct) { - $checkboxlabel=$langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv('StatusOrderReceivedAll')); + $checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv('StatusOrderReceivedAll')); print '
'; - print $langs->trans("Comment") . ' : '; - print 'trans("DispatchSupplierOrder", $object->ref); - // print ' / '.$object->ref_supplier; // Not yet available - print '" class="flat">
'; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + // modified by hook + if (empty($reshook)) + { + print $langs->trans("Comment").' : '; + print 'trans("DispatchSupplierOrder", $object->ref); + // print ' / '.$object->ref_supplier; // Not yet available + print '" class="flat">
'; - print ' '.$checkboxlabel; + print ' '.$checkboxlabel; - print '
'; + print '
'; + } print '
'; } @@ -767,14 +779,14 @@ if ($id > 0 || ! empty($ref)) { print load_fiche_titre($langs->trans("ReceivingForSameOrder")); print '
'; - print '
".$langs->trans("Other")."  
'.$langs->trans("UserWarehouseAutoCreate").''; +print ''; print "
"; print ''; print ""; @@ -456,7 +456,8 @@ print "
'; -print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")).''; print ""; print ''; @@ -502,7 +503,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print '
'.$langs->trans("Inventory").'   
' . $langs->trans("Description") . '' . $langs->trans("batch_number") . '' . $langs->trans("EatByDate") . '' . $langs->trans("SellByDate") . ''.$langs->trans("batch_number").''.$langs->trans("EatByDate").''.$langs->trans("SellByDate").''; + print ''; print $linktoprod; print "'; print $linktoprod; print "'; + print ''; print $langs->trans("ProductDoesNotUseBatchSerial"); print ''; @@ -639,6 +644,7 @@ if ($id > 0 || ! empty($ref)) { print ' '; print '
'; + print '
'; print ''; print ''; if (! empty($conf->productbatch->enabled)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } print ''; print ''; @@ -797,9 +809,9 @@ if ($id > 0 || ! empty($ref)) { print "\n"; if (! empty($conf->productbatch->enabled)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } // Qty diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 14c4f2b6672..f5520b6f232 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -284,6 +284,13 @@ CREATE TABLE llx_ticket_extrafields import_key varchar(14) )ENGINE=innodb; +create table llx_facture_rec_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) +) ENGINE=innodb; -- Create dictionaries tables for ticket diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 9c1a0a35837..4a7ab99ca77 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -100,7 +100,7 @@ AgendaUrlOptions3=logina=%s to restrict output to actions owned by a user AgendaUrlOptionsNotAdmin=logina=!%s to restrict output to actions not owned by user %s. AgendaUrlOptions4=logint=%s to restrict output to actions assigned to user %s (owner and others). AgendaUrlOptionsProject=project=__PROJECT_ID__ to restrict output to actions linked to project __PROJECT_ID__. -AgendaUrlOptionsNotAutoEvent=notactiontype=systemauto to exclude automatic event. +AgendaUrlOptionsNotAutoEvent=notactiontype=systemauto to exclude automatic events. AgendaShowBirthdayEvents=Show birthdays of contacts AgendaHideBirthdayEvents=Hide birthdays of contacts Busy=Busy diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index 3ab90c6d3fa..fb52e8476ee 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -50,4 +50,4 @@ BlockedLogActivatedBecauseRequiredByYourCountryLegislation=Unalterable Logs modu BlockedLogDisableNotAllowedForCountry=List of countries where usage of this module is mandatory (just to prevent to disable the module by error, if your country is in this list, disable of module is not possible without editing this list first. Note also that enabling/disabling this module will keep a track into the unalterable log). OnlyNonValid=Non-valid TooManyRecordToScanRestrictFilters=Too many record to scan/analyze. Please restrict list with more restrictive filters. -RestrictYearToExport=Restrict month / year to export \ No newline at end of file +RestrictYearToExport=Restrict month / year to export diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index cfe49c8a737..b325f2f7443 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -181,6 +181,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'LINEORDER_SUPPLIER_DISPATCH': //case 'LINEORDER_SUPPLIER_CREATE': //case 'LINEORDER_SUPPLIER_UPDATE': + //case 'LINEORDER_SUPPLIER_DELETE': // Proposals //case 'PROPAL_CREATE': diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 2c11b8efd86..83ae57f3d58 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1679,10 +1679,13 @@ else print '
' . $langs->trans("Product") . '' . $langs->trans("batch_number") . '' . $langs->trans("EatByDate") . '' . $langs->trans("SellByDate") . '' . $langs->trans("batch_number") . '' . $langs->trans("EatByDate") . '' . $langs->trans("SellByDate") . '' . $langs->trans("QtyDispatched") . '' . $objp->batch . '' . dol_print_date($db->jdate($objp->eatby), 'day') . '' . dol_print_date($db->jdate($objp->sellby), 'day') . '' . $objp->batch . '' . dol_print_date($db->jdate($objp->eatby), 'day') . '' . dol_print_date($db->jdate($objp->sellby), 'day') . ''; if (! empty($conf->accounting->enabled)) { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('',$object->accountancy_code_sell,1); + if (! empty($object->accountancy_code_sell)) + { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('',$object->accountancy_code_sell,1); - print $accountingaccount->getNomUrl(0,1,1,'',1); + print $accountingaccount->getNomUrl(0,1,1,'',1); + } } else { print $object->accountancy_code_sell; } @@ -1698,10 +1701,13 @@ else print ''; if (! empty($conf->accounting->enabled)) { - $accountingaccount2 = new AccountingAccount($db); - $accountingaccount2->fetch('',$object->accountancy_code_sell_intra,1); + if (! empty($object->accountancy_code_sell_intra)) + { + $accountingaccount2 = new AccountingAccount($db); + $accountingaccount2->fetch('',$object->accountancy_code_sell_intra,1); - print $accountingaccount2->getNomUrl(0,1,1,'',1); + print $accountingaccount2->getNomUrl(0,1,1,'',1); + } } else { print $object->accountancy_code_sell_intra; } @@ -1714,10 +1720,13 @@ else print ''; if (! empty($conf->accounting->enabled)) { - $accountingaccount3 = new AccountingAccount($db); - $accountingaccount3->fetch('',$object->accountancy_code_sell_export,1); + if (! empty($object->accountancy_code_sell_export)) + { + $accountingaccount3 = new AccountingAccount($db); + $accountingaccount3->fetch('',$object->accountancy_code_sell_export,1); - print $accountingaccount3->getNomUrl(0,1,1,'',1); + print $accountingaccount3->getNomUrl(0,1,1,'',1); + } } else { print $object->accountancy_code_sell_export; } @@ -1730,10 +1739,13 @@ else print ''; if (! empty($conf->accounting->enabled)) { - $accountingaccount4 = new AccountingAccount($db); - $accountingaccount4->fetch('',$object->accountancy_code_buy,1); + if (! empty($object->accountancy_code_buy)) + { + $accountingaccount4 = new AccountingAccount($db); + $accountingaccount4->fetch('',$object->accountancy_code_buy,1); - print $accountingaccount4->getNomUrl(0,1,1,'',1); + print $accountingaccount4->getNomUrl(0,1,1,'',1); + } } else { print $object->accountancy_code_buy; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 08a128403ec..ebb40516636 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4430,8 +4430,6 @@ class Product extends CommonObject $langs->load('products'); - //$this->db->begin(); - $label_type = 'label'; if ($type == 'short') diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 55882e3d4f9..51536ad5b0b 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -31,9 +31,8 @@ define("NOLOGIN",1); // This means this output page does not require to be logg define("NOCSRFCHECK",1); // We accept to go on this page from external web site. // For MultiCompany module. -// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php -// TODO This should be useless. Because entity must be retreive from object ref and not from url. -$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +// Do not use GETPOST here, function is not defined and get of entity must be done before including main.inc.php +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : (! empty($_GET['e']) ? (int) $_GET['e'] : (! empty($_POST['e']) ? (int) $_POST['e'] : 1)))); if (is_numeric($entity)) define("DOLENTITY", $entity); require '../../main.inc.php';