Introduce option MAIN_HTML_TITLE to start to control format of html

title content.
This commit is contained in:
Laurent Destailleur 2015-01-17 14:34:16 +01:00
parent 1d1970b5a1
commit 8cd46e4830
6 changed files with 49 additions and 43 deletions

View File

@ -10,6 +10,7 @@ For users:
- Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined' - Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined'
- Add Weighted average price as default price for buying price for margin calculation. Add option - 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. 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: For translators:
- Update language files. - Update language files.

View File

@ -85,7 +85,7 @@ $cancelbutton = GETPOST('cancel');
if ($action == 'setcustomeraccountancycode') if ($action == 'setcustomeraccountancycode')
{ {
if (! $cancelbutton) if (! $cancelbutton)
{ {
$result=$object->fetch($id); $result=$object->fetch($id);
$object->code_compta=$_POST["customeraccountancycode"]; $object->code_compta=$_POST["customeraccountancycode"];
@ -105,6 +105,7 @@ if ($action == 'setconditions' && $user->rights->societe->creer)
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int')); $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
// mode de reglement // mode de reglement
if ($action == 'setmode' && $user->rights->societe->creer) 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')); $result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
// assujetissement a la TVA // assujetissement a la TVA
if ($action == 'setassujtva' && $user->rights->societe->creer) if ($action == 'setassujtva' && $user->rights->societe->creer)
{ {
$object->fetch($id); $object->fetch($id);
$object->tva_assuj=$_POST['assujtva_value']; $object->tva_assuj=$_POST['assujtva_value'];
$result=$object->update($object->id);
// TODO move to DAO class if ($result < 0) dol_print_error($db,$object->error);
$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);
} }
// set prospect level // set prospect level
@ -133,7 +132,7 @@ if ($action == 'setprospectlevel' && $user->rights->societe->creer)
if ($result < 0) setEventMessage($object->error,'errors'); if ($result < 0) setEventMessage($object->error,'errors');
} }
// Update communication level // update prospect level
if ($action == 'cstc') if ($action == 'cstc')
{ {
$object->fetch($id); $object->fetch($id);
@ -142,10 +141,10 @@ if ($action == 'cstc')
if ($result < 0) setEventMessage($object->error,'errors'); if ($result < 0) setEventMessage($object->error,'errors');
} }
// Update communication level // update outstandng limit
if ($action == 'setOutstandingBill') if ($action == 'setOutstandingBill')
{ {
if (!$cancelbutton) if (!$cancelbutton)
{ {
$object->fetch($id); $object->fetch($id);
$object->outstanding_limit=GETPOST('OutstandingBill'); $object->outstanding_limit=GETPOST('OutstandingBill');
@ -159,14 +158,24 @@ if ($action == 'setOutstandingBill')
* View * View
*/ */
llxHeader('',$langs->trans('CustomerCard'));
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
$userstatic=new User($db); $userstatic=new User($db);
$form = new Form($db); $form = new Form($db);
$formcompany=new FormCompany($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') if ($mode == 'search')
{ {
@ -196,14 +205,6 @@ if ($mode == 'search')
if ($id > 0) 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); $head = societe_prepare_head($object);
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"),0,'company');

View File

@ -2191,7 +2191,6 @@ abstract class CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($obj) if ($obj)
{ {
$this->id = $obj->rowid;
$this->canvas = $obj->canvas; $this->canvas = $obj->canvas;
return 1; return 1;
} }

View File

@ -63,7 +63,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if ($action == 'setsupplieraccountancycode') if ($action == 'setsupplieraccountancycode')
{ {
$cancelbutton = GETPOST('cancel'); $cancelbutton = GETPOST('cancel');
if (! $cancelbutton) if (! $cancelbutton)
{ {
$result=$object->fetch($id); $result=$object->fetch($id);
$object->code_compta_fournisseur=$_POST["supplieraccountancycode"]; $object->code_compta_fournisseur=$_POST["supplieraccountancycode"];
@ -98,12 +98,22 @@ if ($action == 'setmode' && $user->rights->societe->creer)
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
$form = new Form($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); $head = societe_prepare_head($object);

View File

@ -976,7 +976,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
// Displays meta // Displays meta
print '<meta name="robots" content="noindex,nofollow">'."\n"; // Evite indexation par robots print '<meta name="robots" content="noindex,nofollow">'."\n"; // Evite indexation par robots
print '<meta name="author" content="Dolibarr Development Team">'."\n"; print '<meta name="author" content="Dolibarr Development Team">'."\n";
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5)) print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n"; // Needed for Responsive Web Design if (! empty($conf->global->MAIN_ACTIVATE_HTML5)) print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n"; // Needed for Responsive Web Design
$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n"; print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n";
@ -988,6 +988,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
$appli='Dolibarr'; $appli='Dolibarr';
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; 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 '<title>'.dol_htmlentities($title).'</title>';
if ($title) print '<title>'.dol_htmlentities($appli.' - '.$title).'</title>'; if ($title) print '<title>'.dol_htmlentities($appli.' - '.$title).'</title>';
else print "<title>".dol_htmlentities($appli)."</title>"; else print "<title>".dol_htmlentities($appli)."</title>";
print "\n"; print "\n";

View File

@ -106,7 +106,6 @@ if (empty($reshook))
{ {
//obtidre selected del combobox //obtidre selected del combobox
$value=GETPOST('lt1'); $value=GETPOST('lt1');
$object = new Societe($db);
$object->fetch($socid); $object->fetch($socid);
$res=$object->setValueFrom('localtax1_value', $value); $res=$object->setValueFrom('localtax1_value', $value);
} }
@ -114,7 +113,6 @@ if (empty($reshook))
{ {
//obtidre selected del combobox //obtidre selected del combobox
$value=GETPOST('lt2'); $value=GETPOST('lt2');
$object = new Societe($db);
$object->fetch($socid); $object->fetch($socid);
$res=$object->setValueFrom('localtax2_value', $value); $res=$object->setValueFrom('localtax2_value', $value);
} }
@ -583,14 +581,22 @@ if (empty($reshook))
* View * View
*/ */
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty"),$help_url);
$form = new Form($db); $form = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
$formcompany = new FormCompany($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").')'; $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
@ -598,12 +604,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
// ----------------------------------------- // -----------------------------------------
// When used with CANVAS // 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->assign_values($action, $object->id, $object->ref); // Set value for templates
$objcanvas->display_canvas($action); // Show template $objcanvas->display_canvas($action); // Show template
} }
@ -1111,9 +1111,6 @@ else
if ($socid) 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); $res=$object->fetch_optionals($object->id,$extralabels);
//if ($res < 0) { dol_print_error($db); exit; } //if ($res < 0) { dol_print_error($db); exit; }
@ -1624,9 +1621,6 @@ else
/* /*
* View * 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); $res=$object->fetch_optionals($object->id,$extralabels);
//if ($res < 0) { dol_print_error($db); exit; } //if ($res < 0) { dol_print_error($db); exit; }