From abe3f192fabf5303041d6e65db31e56d3b8afd90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jan 2016 16:23:23 +0100 Subject: [PATCH] Debug and fix when using dolibarr with jmobile --- htdocs/compta/recap-compta.php | 12 ++-- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/search_page.php | 81 ++++++++++++++++++--------- htdocs/fourn/recap-fourn.php | 42 ++++---------- htdocs/main.inc.php | 24 +------- htdocs/societe/list.php | 8 +-- htdocs/theme/eldy/style.css.php | 15 +++-- htdocs/theme/md/style.css.php | 17 +++--- 8 files changed, 97 insertions(+), 104 deletions(-) diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 920419a8769..3f952ef15c6 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * * 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 @@ -19,7 +19,7 @@ /** * \file htdocs/compta/recap-compta.php * \ingroup compta - * \brief Page de fiche recap compta + * \brief Page de fiche recap customer */ require '../main.inc.php'; @@ -61,10 +61,11 @@ if ($socid > 0) dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company'); dol_banner_tab($societe, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + dol_fiche_end(); + if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { - // Factures + // Invoice list print load_fiche_titre($langs->trans("CustomerPreview")); print ''; @@ -226,10 +227,7 @@ if ($socid > 0) } print "
"; - print "
"; } - - print ''; } else { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index dc3166f274d..efc994a0446 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4850,7 +4850,7 @@ class Form
-
    +
      '.$lis.'
diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index e412aa68e5e..0d9beadee90 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -66,40 +66,69 @@ $hookmanager->initHooks(array('searchform')); // Define $searchform $searchform = ''; + // TODO Mutualize code here with function left_menu into main.inc.php page -if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire) +if ($conf->use_javascript_ajax && 1 == 2) { - $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'sall', '', 'company'); - $nbofsearch++; + if (! is_object($form)) $form=new Form($db); + $selected=-1; + $searchform.=$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, 'data-role="none"', '', 0, 1, 'vmenusearchselectcombo', 1, $langs->trans("Search"), 0); } - -if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire) +else { - $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'sall', '', 'contact'); - $nbofsearch++; -} + // Define $searchform + if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire) + { + $langs->load("companies"); + $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'sall', 'T', 'searchleftt', img_object('','company')); + } -if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) - && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)) -{ - $langs->load("products"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', '', 'product'); - $nbofsearch++; -} + if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire) + { + $langs->load("companies"); + $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'sall', 'A', 'searchleftc', img_object('','contact')); + } -if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire) -{ - $langs->load("members"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', '', 'member'); - $nbofsearch++; + if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) + && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)) + { + $langs->load("products"); + $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', $langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleftp', img_object('','product')); + } + + if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->fournisseur->enabled) + && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER)) + { + $langs->load("products"); + $searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/list.php', DOL_URL_ROOT.'/fourn/product/list.php', $langs->trans("SupplierRef"), 'products', 'srefsupplier', '', 'searchlefts', img_object('','product')); + } + + if (! empty($conf->projet->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_PROJECT) && $user->rights->projet->lire) + { + $langs->load("projects"); + $searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub')); + } + + if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire) + { + $langs->load("members"); + $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', $langs->trans("Members"), 'member', 'sall', 'M', 'searchleftm', img_object('','user')); + } + + if (! empty($conf->user->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_USER) && $user->rights->user->user->lire) + { + $langs->load("users"); + $searchform.=printSearchForm(DOL_URL_ROOT.'/user/list.php', DOL_URL_ROOT.'/user/list.php', $langs->trans("Users"), 'user', 'sall', 'M', 'searchleftuser', img_object('','user')); + } } // Execute hook printSearchForm -$parameters=array(); -$reshook=$hookmanager->executeHooks('printSearchForm',$parameters); -if (empty($reshook)) $searchform.=$hookmanager->resPrint; +$parameters=array('searchform'=>$searchform); +$reshook=$hookmanager->executeHooks('printSearchForm',$parameters); // Note that $action and $object may have been modified by some hooks +if (empty($reshook)) +{ + $searchform.=$hookmanager->resPrint; +} else $searchform=$hookmanager->resPrint; @@ -113,7 +142,7 @@ print $searchform; print ''."\n"; //print ''; print ''; -print "\n"; +print "\n\n"; print ''; print ''."\n"; diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index acf4c9400d3..1137f0de14b 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * * 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 @@ -19,7 +19,7 @@ /** * \file htdocs/fourn/recap-fourn.php * \ingroup fournisseur - * \brief Page de fiche recap fournisseur + * \brief Page de fiche recap supplier */ require '../main.inc.php'; @@ -30,7 +30,7 @@ $langs->load("companies"); $langs->load("bills"); // Security check -$socid = $_GET["socid"]; +$socid = GETPOST("socid",'int'); if ($user->societe_id > 0) { $action = ''; @@ -43,6 +43,9 @@ if ($user->societe_id > 0) * View */ +$form = new Form($db); +$userstatic=new User($db); + llxHeader(); if ($socid > 0) @@ -56,36 +59,12 @@ if ($socid > 0) $head = societe_prepare_head($societe); dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"), 0, 'company'); - - - print "\n"; - print '
'; - - print ''; - - // Nom - print ''; - - // Prefix - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field - { - print ''; - } - - print "
'.$langs->trans("Name").''.$societe->nom.'
'.$langs->trans("Prefix").''; - print ($societe->prefix_comm?$societe->prefix_comm:' '); - print '
"; - - print "
\n"; - - print ''; - - - + dol_banner_tab($societe, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + dol_fiche_end(); if (! empty($conf->fournisseur->enabled) && $user->rights->facture->lire) { - // Invoices list + // Invoice list print load_fiche_titre($langs->trans("SupplierPreview")); print ''; @@ -203,10 +182,9 @@ if ($socid > 0) { dol_print_error($db); } + print "
"; - print "
"; } - } else { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index eaa2e3142e3..15f38504971 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1683,33 +1683,11 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra print '
'."\n\n"; - // Show other forms - /*if ($searchform) - { - print "\n"; - print "\n"; - print '
'."\n"; - print $searchform; - print '
'."\n"; - print "\n"; - }*/ - + // Show left menu with other forms $menumanager->menu_array = $menu_array_before; $menumanager->menu_array_after = $menu_array_after; $menumanager->showmenu('left', array('searchform'=>$searchform, 'bookmarks'=>$bookmarks)); // output menu_array and menu found in database - // Bookmarks - /* - if ($bookmarks) - { - print "\n"; - print "\n"; - print '
'."\n"; - print $bookmarks; - print '
'."\n"; - print "\n"; - }*/ - // Dolibarr version + help + bug report link print "\n"; print "\n"; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index fcee0c2cdf7..4a9efd40585 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -654,7 +654,7 @@ if ($resql) // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; } @@ -702,7 +702,7 @@ if ($resql) } // Type (customer/prospect/supplier) - print ''; + print ''; print '