From 8cd46e483088cd72fd35225d2c8028e0075469fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Jan 2015 14:34:16 +0100 Subject: [PATCH] Introduce option MAIN_HTML_TITLE to start to control format of html title content. --- ChangeLog | 1 + htdocs/comm/card.php | 41 ++++++++++++------------ htdocs/core/class/commonobject.class.php | 1 - htdocs/fourn/card.php | 18 ++++++++--- htdocs/main.inc.php | 3 +- htdocs/societe/soc.php | 28 +++++++--------- 6 files changed, 49 insertions(+), 43 deletions(-) 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 ''.dol_htmlentities($title).''; if ($title) print ''.dol_htmlentities($appli.' - '.$title).''; else print "".dol_htmlentities($appli).""; print "\n"; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 656e88ec83c..67757376569 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -106,7 +106,6 @@ if (empty($reshook)) { //obtidre selected del combobox $value=GETPOST('lt1'); - $object = new Societe($db); $object->fetch($socid); $res=$object->setValueFrom('localtax1_value', $value); } @@ -114,7 +113,6 @@ if (empty($reshook)) { //obtidre selected del combobox $value=GETPOST('lt2'); - $object = new Societe($db); $object->fetch($socid); $res=$object->setValueFrom('localtax2_value', $value); } @@ -583,14 +581,22 @@ if (empty($reshook)) * View */ -$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; -llxHeader('',$langs->trans("ThirdParty"),$help_url); - $form = new Form($db); $formfile = new FormFile($db); $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); +if ($socid > 0 && empty($object->id)) +{ + $res=$object->fetch($socid); + if ($result <= 0) dol_print_error('',$object->error); +} + +$title=$langs->trans("ThirdParty"); +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); + $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) @@ -598,12 +604,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // ----------------------------------------- // When used with CANVAS // ----------------------------------------- - if (empty($object->error) && $socid) - { - $object = new Societe($db); - $result=$object->fetch($socid); - if ($result <= 0) dol_print_error('',$object->error); - } $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template } @@ -1111,9 +1111,6 @@ else if ($socid) { - $object = new Societe($db); - $res=$object->fetch($socid); - if ($res < 0) { dol_print_error($db,$object->error); exit; } $res=$object->fetch_optionals($object->id,$extralabels); //if ($res < 0) { dol_print_error($db); exit; } @@ -1624,9 +1621,6 @@ else /* * View */ - $object = new Societe($db); - $res=$object->fetch($socid); - if ($res < 0) { dol_print_error($db,$object->error); exit; } $res=$object->fetch_optionals($object->id,$extralabels); //if ($res < 0) { dol_print_error($db); exit; }