diff --git a/ChangeLog b/ChangeLog index 3e61b274398..37b693f2ab8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ For users: - Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined' - Add Weighted average price as default price for buying price for margin calculation. Add option MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price. +- Introduce option MAIN_HTML_TITLE to start to control format of html title content. For translators: - Update language files. diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 5b64c834401..ecb171c6570 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -85,7 +85,7 @@ $cancelbutton = GETPOST('cancel'); if ($action == 'setcustomeraccountancycode') { - if (! $cancelbutton) + if (! $cancelbutton) { $result=$object->fetch($id); $object->code_compta=$_POST["customeraccountancycode"]; @@ -105,6 +105,7 @@ if ($action == 'setconditions' && $user->rights->societe->creer) $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int')); if ($result < 0) dol_print_error($db,$object->error); } + // mode de reglement if ($action == 'setmode' && $user->rights->societe->creer) { @@ -112,16 +113,14 @@ if ($action == 'setmode' && $user->rights->societe->creer) $result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int')); if ($result < 0) dol_print_error($db,$object->error); } + // assujetissement a la TVA if ($action == 'setassujtva' && $user->rights->societe->creer) { $object->fetch($id); $object->tva_assuj=$_POST['assujtva_value']; - - // TODO move to DAO class - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$id."'"; - $result = $db->query($sql); - if (! $result) dol_print_error($result); + $result=$object->update($object->id); + if ($result < 0) dol_print_error($db,$object->error); } // set prospect level @@ -133,7 +132,7 @@ if ($action == 'setprospectlevel' && $user->rights->societe->creer) if ($result < 0) setEventMessage($object->error,'errors'); } -// Update communication level +// update prospect level if ($action == 'cstc') { $object->fetch($id); @@ -142,10 +141,10 @@ if ($action == 'cstc') if ($result < 0) setEventMessage($object->error,'errors'); } -// Update communication level +// update outstandng limit if ($action == 'setOutstandingBill') { - if (!$cancelbutton) + if (!$cancelbutton) { $object->fetch($id); $object->outstanding_limit=GETPOST('OutstandingBill'); @@ -159,14 +158,24 @@ if ($action == 'setOutstandingBill') * View */ -llxHeader('',$langs->trans('CustomerCard')); - - $contactstatic = new Contact($db); $userstatic=new User($db); $form = new Form($db); $formcompany=new FormCompany($db); +if ($id > 0 && empty($object->id)) +{ + // Load data of third party + $res=$object->fetch($id); + if ($object->id <= 0) dol_print_error($db,$object->error); +} + +$title=$langs->trans("CustomerCard"); +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name; +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('',$title,$help_url); + + if ($mode == 'search') { @@ -196,14 +205,6 @@ if ($mode == 'search') if ($id > 0) { - // Load data of third party - $object->fetch($id); - if ($object->id <= 0) - { - dol_print_error($db,$object->error); - } - - $head = societe_prepare_head($object); dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"),0,'company'); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 183fed325be..c2718cf504c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2191,7 +2191,6 @@ abstract class CommonObject $obj = $this->db->fetch_object($resql); if ($obj) { - $this->id = $obj->rowid; $this->canvas = $obj->canvas; return 1; } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 8511a3e1a48..0447bd0a758 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -63,7 +63,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if ($action == 'setsupplieraccountancycode') { $cancelbutton = GETPOST('cancel'); - if (! $cancelbutton) + if (! $cancelbutton) { $result=$object->fetch($id); $object->code_compta_fournisseur=$_POST["supplieraccountancycode"]; @@ -98,12 +98,22 @@ if ($action == 'setmode' && $user->rights->societe->creer) $contactstatic = new Contact($db); $form = new Form($db); -if ($object->fetch($id)) +if ($id > 0 && empty($object->id)) { - llxHeader('',$langs->trans('SupplierCard')); + // Load data of third party + $res=$object->fetch($id); + if ($object->id <= 0) dol_print_error($db,$object->error); +} + +if ($object->id > 0) +{ + $title=$langs->trans("SupplierCard"); + if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name; + $help_url=''; + llxHeader('',$title, $help_url); /* - * Affichage onglets + * Show tabs */ $head = societe_prepare_head($object); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b805e098706..48f788c96fa 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -976,7 +976,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs // Displays meta print ''."\n"; // Evite indexation par robots print ''."\n"; - if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5)) print ''."\n"; // Needed for Responsive Web Design + if (! empty($conf->global->MAIN_ACTIVATE_HTML5)) print ''."\n"; // Needed for Responsive Web Design $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; print ''."\n"; @@ -988,6 +988,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs $appli='Dolibarr'; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; + if ($title && ! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/',$conf->global->MAIN_HTML_TITLE)) print '