From ba64486e68763f5575b1493f16b3411a1707e9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20L=C3=A9onard?= Date: Mon, 22 Jun 2015 02:53:28 +0200 Subject: [PATCH 1/8] Remove useless filter for "text" parameter of boxes content This filter doesn't allow to display "0" value and is not applied to the similar "text2" parameter. --- htdocs/core/boxes/modules_boxes.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index dfe83012acf..d1d05ec28a8 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -273,7 +273,6 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $tdparam=''; if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td']; - if (empty($contents[$i][$j]['text'])) $contents[$i][$j]['text']=""; $text=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:''; $textwithnotags=preg_replace('/<([^>]+)>/i','',$text); $text2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:''; From a27212644eeb1cdca5ef684350e210a08d4988f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Jun 2015 11:55:21 +0200 Subject: [PATCH 2/8] NEW Can add project search on left menu search area --- htdocs/adherents/list.php | 3 +- htdocs/admin/ihm.php | 9 +- htdocs/barcode/codeinit.php | 10 +- htdocs/core/lib/project.lib.php | 2 +- htdocs/cron/card.php | 4 +- htdocs/cron/class/cronjob.class.php | 4 +- htdocs/langs/en_US/cron.lang | 1 + htdocs/langs/en_US/projects.lang | 3 +- htdocs/main.inc.php | 6 + htdocs/projet/element.php | 376 ++++++++++++++------------- htdocs/projet/list.php | 11 +- htdocs/public/cron/cron_run_jobs.php | 4 +- htdocs/support/default.css | 2 +- htdocs/support/index.php | 8 +- 14 files changed, 239 insertions(+), 204 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index ff6c1eb7963..ec8ff84b763 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -199,7 +199,8 @@ if ($resql) if ($sall) { - print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; + print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): "; + print ''.$sall.''; } print '
'; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 398999d6dd9..28f221131e1 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -45,10 +45,10 @@ $action = GETPOST('action'); if (! defined("MAIN_MOTD")) define("MAIN_MOTD",""); // List of supported permanent search area -$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT"); -$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT); -$searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"),$langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')',$langs->trans("Members")); -$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name'); +$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT"); +$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT); +$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')', $langs->trans("Members"), $langs->trans("Projects")); +$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name','Module400Name'); if ($action == 'update') @@ -73,6 +73,7 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE", $_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT", $_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SEARCHFORM_PROJECT", $_POST["MAIN_SEARCHFORM_PROJECT"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity); diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 12b61d80419..bd8f2194fe4 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2015 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 @@ -211,7 +211,7 @@ if ($conf->societe->enabled) { $nbno=$nbtotal=0; - print_fiche_titre($langs->trans("BarcodeInitForThirdparties"),'',''); + print_fiche_titre($langs->trans("BarcodeInitForThirdparties"),'','object_company'); print '
'."\n"; $sql="SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe where barcode IS NULL or barcode = ''"; $resql=$db->query($sql); @@ -236,7 +236,7 @@ if ($conf->societe->enabled) print '
'; - print '


'; + print '



'; } @@ -252,7 +252,7 @@ if ($conf->product->enabled || $conf->product->service) $nbno=$nbtotal=0; - print_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"),'',''); + print_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"),'','object_product'); print '
'."\n"; $sql ="SELECT count(rowid) as nb, fk_product_type, datec"; @@ -312,7 +312,7 @@ if ($conf->product->enabled || $conf->product->service) $moretags2=(($nbno == $nbtotal)?' disabled':''); print '   '; print ''; - print '


'; + print '



'; } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 556dbc0a1c6..80c16c8aeb1 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -53,7 +53,7 @@ function project_prepare_head($object) || ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id; - $head[$h][1] = $langs->trans("ProjectReferers"); + $head[$h][1] = $langs->trans("Overview"); $head[$h][2] = 'element'; $h++; } diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 500506b532e..f2c4a93e030 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -594,7 +594,9 @@ else print ""; print ''; - print $langs->trans('CronDtNextLaunch').""; + print $langs->trans('CronDtNextLaunch'); + print ' ('.$langs->trans('CronFrom').')'; + print ""; if(!empty($object->datenextrun)) {print dol_print_date($object->datenextrun,'dayhourtext');} else {print $langs->trans('CronNone');} print ""; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 5f2ef68b194..26ae969e493 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -842,8 +842,8 @@ class Cronjob extends CommonObject /** * Run a job * - * @param string $userlogin User login - * @return int <0 if KO, >0 if OK + * @param string $userlogin User login + * @return int <0 if KO, >0 if OK */ function run_jobs($userlogin) { diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index ff511f00d27..5369859bb8b 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -76,6 +76,7 @@ CronMethodHelp=The object method to launch.
For exemple to fetch method of CronArgsHelp=The method arguments.
For exemple to fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value of paramters can be 0, ProductRef CronCommandHelp=The system command line to execute. CronCreateJob=Create new Scheduled Job +CronFrom=From # Info CronInfoPage=Information # Common diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 25db18df474..52e1b942a6c 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -151,4 +151,5 @@ TasksWithThisUserAsContact=Tasks assigned to this user ResourceNotAssignedToProject=Not assigned to project ResourceNotAssignedToTask=Not assigned to task AssignTaskToMe=Assign task to me -AssignTask=Assign \ No newline at end of file +AssignTask=Assign +ProjectOverview=Overview \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 234949272f0..3d7da011d4a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1555,6 +1555,12 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me $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->projet->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_PROJECT) && $user->rights->projet->lire) + { + $langs->load("members"); + $searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'M', 'searchleftproj', img_object('','projectpub')); + } + // Execute hook printSearchForm $parameters=array(); $reshook=$hookmanager->executeHooks('printSearchForm',$parameters); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index a9089673ae6..8bb7c9f75ce 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -293,7 +293,188 @@ if ($action=="addelement") $elementuser = new User($db); + + $showdatefilter=0; +// Show the filter on date on top of element list +if (! $showdatefilter) +{ + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'.$langs->trans("From").' '; + print $form->select_date($dates,'dates',0,0,1); + print ''.$langs->trans("to").' '; + print $form->select_date($datee,'datee',0,0,1); + print ''; + print ''; + print '
'; + print ''; + + $showdatefilter++; +} + + + +// Show balance for whole project + +$langs->load("suppliers"); +$langs->load("bills"); +$langs->load("orders"); +$langs->load("proposals"); +$langs->load("margins"); + +//print load_fiche_titre($langs->trans("Profit"),'','title_accountancy'); +print '
'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'

'; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +$var = false; + +foreach ($listofreferent as $key => $value) +{ + $name=$langs->trans($value['name']); + $title=$value['title']; + $classname=$value['class']; + $tablename=$value['table']; + $datefieldname=$value['datefieldname']; + $qualified=$value['test']; + $margin = $value['margin']; + if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'plus') + { + $element = new $classname($db); + + $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee); + if (count($elementarray)>0 && is_array($elementarray)) + { + $var=true; + $total_ht = 0; + $total_ttc = 0; + + $num=count($elementarray); + for ($i = 0; $i < $num; $i++) + { + $tmp=explode('_',$elementarray[$i]); + $idofelement=$tmp[0]; + $idofelementuser=$tmp[1]; + + $element->fetch($idofelement); + if ($idofelementuser) $elementuser->fetch($idofelementuser); + + if ($tablename != 'expensereport_det') $element->fetch_thirdparty(); + + if ($tablename == 'don') $total_ht_by_line=$element->amount; + elseif ($tablename == 'projet_task') + { + if ($idofelementuser) + { + $tmp = $element->getSumOfAmount($elementuser, $dates, $datee); + $total_ht_by_line = price2num($tmp['amount'],'MT'); + } + else + { + $tmp = $element->getSumOfAmount('', $dates, $datee); + $total_ht_by_line = price2num($tmp['amount'],'MT'); + } + } + else $total_ht_by_line=$element->total_ht; + + $total_ht = $total_ht + $total_ht_by_line; + + if ($tablename == 'don') $total_ttc_by_line=$element->amount; + elseif ($tablename == 'projet_task') + { + $defaultvat = get_default_tva($mysoc, $mysoc); + $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT'); + } + else $total_ttc_by_line=$element->total_ttc; + + $total_ttc = $total_ttc + $total_ttc_by_line; + } + + // Calculate margin + if ($margin=="add") + { + $balance_ht+= $total_ht; + $balance_ttc+= $total_ttc; + } + else + { + $balance_ht-= $total_ht; + $balance_ttc-= $total_ttc; + } + + // Show $total_ht & $total_ttc -- add a minus when necessary + if ($margin!="add") + { + $total_ht = -$total_ht; + $total_ttc = -$total_ttc; + } + + switch ($classname) { + case 'FactureFournisseur': + $newclassname = 'SupplierInvoice'; + break; + case 'Facture': + $newclassname = 'Bill'; + break; + case 'Propal': + $newclassname = 'CommercialProposal'; + break; + case 'Commande': + $newclassname = 'Order'; + break; + case 'Expedition': + $newclassname = 'Sending'; + break; + case 'Contrat': + $newclassname = 'Contract'; + break; + default: + $newclassname = $classname; + } + + $var = ! $var; + print ''; + // Module + print ''; + // Nb + print ''; + // Amount HT + print ''; + // Amount TTC + print ''; + print ''; + } + } +} +// and the final balance +print ''; +print ''; +print ''; +print ''; +print ''; + +print "
'.$langs->trans("Element").''.$langs->trans("Number").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").'
'.$langs->trans($newclassname).''.$i.''.price($total_ht).''.price($total_ttc).'
'.$langs->trans("Total").''.price($balance_ht).''.price($balance_ttc).'
"; + + + +print '

'; +print '
'; + + + +// Detail foreach ($listofreferent as $key => $value) { $title=$value['title']; @@ -310,32 +491,7 @@ foreach ($listofreferent as $key => $value) $element = new $classname($db); - // Show the filter on date on top of element list - if (! $showdatefilter) - { - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans("From").' '; - print $form->select_date($dates,'dates',0,0,1); - print ''.$langs->trans("to").' '; - print $form->select_date($datee,'datee',0,0,1); - print ''; - print ''; - print '
'; - print '

'; - - $showdatefilter++; - } - - print '
'; - - print_titre($langs->trans($title)); - + $addform=''; $selectList=$formproject->select_element($tablename,$object->thirdparty->id); if (! $selectList || ($selectList<0)) { @@ -343,17 +499,20 @@ foreach ($listofreferent as $key => $value) } elseif($selectList) { - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans("SelectElement").''.$selectList.'
'; - print '
'; + $addform.='
'; + $addform.=''; + $addform.=''; + $addform.=''; + $addform.=''; + $addform.=''; + $addform.=''; + $addform.=''; + $addform.='
'.$langs->trans("SelectElement").''.$selectList.'
'; + $addform.='
'; } + + print_fiche_titre($langs->trans($title), $addform, ''); + print ''; print ''; @@ -675,151 +834,6 @@ foreach ($listofreferent as $key => $value) } -// Show profit summary for whole project - -$langs->load("suppliers"); -$langs->load("bills"); -$langs->load("orders"); -$langs->load("proposals"); -$langs->load("margins"); - -//print load_fiche_titre($langs->trans("Profit"),'','title_accountancy'); -print '
'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'

'; - -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -foreach ($listofreferent as $key => $value) -{ - $name=$langs->trans($value['name']); - $title=$value['title']; - $classname=$value['class']; - $tablename=$value['table']; - $datefieldname=$value['datefieldname']; - $qualified=$value['test']; - $margin = $value['margin']; - if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'plus') - { - $element = new $classname($db); - - $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee); - if (count($elementarray)>0 && is_array($elementarray)) - { - $var=true; - $total_ht = 0; - $total_ttc = 0; - - $num=count($elementarray); - for ($i = 0; $i < $num; $i++) - { - $tmp=explode('_',$elementarray[$i]); - $idofelement=$tmp[0]; - $idofelementuser=$tmp[1]; - - $element->fetch($idofelement); - if ($idofelementuser) $elementuser->fetch($idofelementuser); - - if ($tablename != 'expensereport_det') $element->fetch_thirdparty(); - - if ($tablename == 'don') $total_ht_by_line=$element->amount; - elseif ($tablename == 'projet_task') - { - if ($idofelementuser) - { - $tmp = $element->getSumOfAmount($elementuser, $dates, $datee); - $total_ht_by_line = price2num($tmp['amount'],'MT'); - } - else - { - $tmp = $element->getSumOfAmount('', $dates, $datee); - $total_ht_by_line = price2num($tmp['amount'],'MT'); - } - } - else $total_ht_by_line=$element->total_ht; - - $total_ht = $total_ht + $total_ht_by_line; - - if ($tablename == 'don') $total_ttc_by_line=$element->amount; - elseif ($tablename == 'projet_task') - { - $defaultvat = get_default_tva($mysoc, $mysoc); - $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT'); - } - else $total_ttc_by_line=$element->total_ttc; - - $total_ttc = $total_ttc + $total_ttc_by_line; - } - - // Calculate margin - if ($margin=="add") - { - $margin_ht+= $total_ht; - $margin_ttc+= $total_ttc; - } - else - { - $margin_ht-= $total_ht; - $margin_ttc-= $total_ttc; - } - - // Show $total_ht & $total_ttc -- add a minus when necessary - if ($margin!="add") - { - $total_ht = -$total_ht; - $total_ttc = -$total_ttc; - } - - switch ($classname) { - case 'FactureFournisseur': - $newclassname = 'SupplierInvoice'; - break; - case 'Facture': - $newclassname = 'Bill'; - break; - case 'Propal': - $newclassname = 'CommercialProposal'; - break; - case 'Commande': - $newclassname = 'Order'; - break; - case 'Expedition': - $newclassname = 'Sending'; - break; - case 'Contrat': - $newclassname = 'Contract'; - break; - default: - $newclassname = $classname; - } - - print ''; - // Module - print ''; - // Nb - print ''; - // Amount HT - print ''; - // Amount TTC - print ''; - print ''; - } - } -} -// and the margin amount total -print ''; -print ''; -print ''; -print ''; -print ''; - -print "
'.$langs->trans("Element").''.$langs->trans("Number").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").'
'.$langs->trans($newclassname).''.$i.''.price($total_ht).''.price($total_ttc).'
'.$langs->trans("Total").''.price($margin_ht).''.price($margin_ttc).'
"; - - llxFooter(); $db->close(); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 704b5413b4f..3463f3d0a7a 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -61,6 +61,7 @@ $pagenext = $page + 1; $mine = $_REQUEST['mode']=='mine' ? 1 : 0; +$search_all=GETPOST("search_all"); $search_ref=GETPOST("search_ref"); $search_label=GETPOST("search_label"); $search_societe=GETPOST("search_societe"); @@ -83,11 +84,11 @@ if ($search_status == '') $search_status=-1; // -1 or 1 // Purge criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { + $search_all=''; $search_ref=""; $search_label=""; $search_societe=""; $search_year=""; - $search_all=0; $search_status=-1; $search_public=""; $search_sale=""; @@ -189,7 +190,6 @@ if ($search_user > 0) $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='project' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user; } - $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); //print $sql; @@ -205,6 +205,7 @@ if ($resql) $param=''; if ($month) $param.='&month='.$month; if ($year) $param.='&year=' .$year; + if ($search_all != '') $param.='&search_all='.$search_all; if ($search_ref != '') $param.='&search_ref='.$search_ref; if ($search_label != '') $param.='&search_label='.$search_label; if ($search_societe != '') $param.='&search_societe='.$search_societe; @@ -228,6 +229,12 @@ if ($resql) else print $langs->trans("ProjectsPublicDesc").'

'; } + if ($search_all) + { + print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Label")." ".$langs->trans("or")." ".$langs->trans("ThirdParty")."): "; + print ''.$search_all.''; + } + // If the user can view prospects other than his' if ($user->rights->societe->client->voir || $socid) { diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index e6333526c7f..022a7641cab 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013 Laurent Destailleur + * Copyright (C) 2013-2015 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 @@ -149,7 +149,7 @@ if (is_array($object->lines) && (count($object->lines)>0)) } // Execut job $result=$cronjob->run_jobs($userlogin); - if ($result<0) + if ($result < 0) { echo "Error:".$cronjob->error; dol_syslog("cron_run_jobs.php:: run_jobs Error".$cronjob->error, LOG_ERR); diff --git a/htdocs/support/default.css b/htdocs/support/default.css index ea62df52ef0..1505e59d998 100644 --- a/htdocs/support/default.css +++ b/htdocs/support/default.css @@ -147,7 +147,7 @@ background: #DDDFDD; } table { font-size: 12px; } -table.login { border: 1px solid #C0C0C0; background: #F0F0F0; font-size: 12px; } +table.login { border: 1px solid #C0C0C0; background: #FFF; font-size: 12px; } .inline-block { diff --git a/htdocs/support/index.php b/htdocs/support/index.php index 755863707e5..dbde74ed857 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2015 Laurent Destailleur * Copyright (C) 2008-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menent * @@ -194,7 +194,8 @@ print ''; print ''; print ''; -$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers'; +#$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers'; +$urlwiki='http://partners.dolibarr.org'; print ''; print ''; print '
'; @@ -228,7 +229,8 @@ print '
'; print ''; print ''; -$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers'; +#$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers'; +$urlwiki='http://partners.dolibarr.org'; print ''; print ''; print ''."\n"; // Fields title search @@ -264,7 +277,8 @@ if ($action == 'list' || empty($id)) print ''; print ''; $parameters=array(); - $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print ''."\n"; @@ -287,8 +301,9 @@ if ($action == 'list' || empty($id)) print $obj->field2; print ''; $parameters=array('obj' => $obj); - $formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook - print ''; + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; } $i++; } @@ -302,7 +317,8 @@ if ($action == 'list' || empty($id)) $db->free($resql); $parameters=array('sql' => $sql); - $formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print "
'; From 5a8e76309983d30346a479dfc005f2559d17c8f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Jun 2015 15:48:48 +0200 Subject: [PATCH 3/8] Uniformize code for hooks Uniformize page name societe.php into list.php --- dev/skeletons/skeleton_page.php | 28 ++++-- htdocs/comm/list.php | 73 +++++++------- htdocs/comm/prospect/list.php | 55 ++++++----- htdocs/core/lib/functions.lib.php | 6 +- htdocs/core/menus/standard/eldy.lib.php | 2 + htdocs/core/search_page.php | 2 +- htdocs/fourn/list.php | 26 ++--- htdocs/main.inc.php | 2 +- htdocs/projet/list.php | 70 +++++++------- .../canvas/actions_card_common.class.php | 2 +- htdocs/societe/index.php | 2 +- htdocs/societe/{societe.php => list.php} | 94 ++++++++++--------- htdocs/societe/soc.php | 2 +- 13 files changed, 203 insertions(+), 161 deletions(-) rename htdocs/societe/{societe.php => list.php} (86%) diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php index 334980b1470..653fd617a06 100644 --- a/dev/skeletons/skeleton_page.php +++ b/dev/skeletons/skeleton_page.php @@ -74,6 +74,7 @@ if (($id > 0 || ! empty($ref)) && $action != 'add') // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('skeleton')); +$extrafields = new ExtraFields($db); @@ -230,8 +231,18 @@ if ($action == 'list' || empty($id)) $sql.= " t.rowid,"; $sql.= " t.field1,"; $sql.= " t.field2"; + // Add fields for extrafields + foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; + // Add fields from hooks + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook + $sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; $sql.= " WHERE field3 = 'xxx'"; + // Add where from hooks + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook + $sql.=$hookmanager->resPrint; $sql.= " ORDER BY field1 ASC"; print '
'; @@ -241,7 +252,8 @@ if ($action == 'list' || empty($id)) print '
'; print $moreforfilter; $parameters=array(); - $formconfirm=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print '
'; } @@ -252,7 +264,8 @@ if ($action == 'list' || empty($id)) print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); $parameters=array(); - $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print '
\n"; print "\n"; diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index cf5bacc5e25..9e42d2e7167 100644 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -66,6 +66,7 @@ if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('customerlist')); +$extrafields = new ExtraFields($db); /* @@ -107,6 +108,12 @@ llxHeader('',$langs->trans("ThirdParty"),$help_url); $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.zip, s.town, st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta, s.status as status,"; $sql.= " s.datec, s.canvas"; if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) +// Add fields for extrafields +foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale @@ -116,33 +123,22 @@ $sql.= " AND s.client IN (1, 3)"; $sql.= ' AND s.entity IN ('.getEntity('societe', 1).')'; if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; if ($socid) $sql.= " AND s.rowid = ".$socid; -if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid; if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; -if ($search_company) { - $sql .= natural_search( - array( - 's.nom', - 's.name_alias' - ), - $search_company - ); -} -if ($search_zipcode) $sql.= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'"; -if ($search_town) { - $sql .= natural_search('s.town', $search_town); -} -if ($search_code) $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'"; -if ($search_compta) $sql.= " AND s.code_compta LIKE '%".$db->escape($search_compta)."%'"; - -if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status); -// Insert sale filter -if ($search_sale > 0) -{ - $sql .= " AND sc.fk_user = ".$search_sale; -} +if ($search_company) $sql.= natural_search(array('s.nom', 's.name_alias'), $search_company); +if ($search_zipcode) $sql.= natural_search("s.zip", $search_zipcode); +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_code) $sql.= natural_search("s.code_client", $search_code); +if ($search_compta) $sql.= natural_search("s.code_compta", $search_compta); +if ($search_status!='') $sql.= " AND s.status = ".$db->escape($search_status); +if ($search_sale > 0) $sql.= " AND sc.fk_user = ".$search_sale; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; // Count total nb of records $nbtotalofrecords = 0; @@ -190,6 +186,9 @@ if ($result) { print '
'; print $moreforfilter; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print '
'; } @@ -202,11 +201,12 @@ if ($result) print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","",$param,'align="right"',$sortfield,$sortorder); + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre(''); - $parameters=array(); - $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook - print "\n"; + print "\n"; print ''; @@ -234,6 +234,10 @@ if ($result) print ' '; print ''; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print ''; @@ -242,9 +246,6 @@ if ($result) print ''; print ''; - $parameters=array(); - $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook - print ''."\n"; @@ -272,12 +273,15 @@ if ($result) print ''.$obj->code_client.''; print ''.$obj->code_compta.''; print ''.dol_print_date($db->jdate($obj->datec),'day').''; - print ''.$thirdpartystatic->getLibStatut(3); - print ''; - print ''; $parameters=array('obj' => $obj); - $formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print ''.$thirdpartystatic->getLibStatut(3); + print ''; + + print ''; print "\n"; $i++; @@ -285,7 +289,8 @@ if ($result) $db->free($result); $parameters=array('sql' => $sql); - $formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print "\n"; print "\n"; diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 68299c9a781..5f841b609da 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -156,6 +156,7 @@ $sts = array(-1,0,1,2,3); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('prospectlist')); +$extrafields = new ExtraFields($db); // Do we click on purge search criteria ? if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers @@ -214,6 +215,12 @@ $sql.= " s.prefix_comm, s.fk_prospectlevel, s.fk_stcomm as stcomm_id,"; $sql.= " st.libelle as stcomm_label,"; $sql.= " d.nom as departement"; if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) +// Add fields for extrafields +foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)"; @@ -229,15 +236,7 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid; if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; -if ($search_nom) { - $sql .= natural_search( - array( - 's.nom', - 's.name_alias' - ), - $search_nom - ); -} +if ($search_nom) $sql .= natural_search(array('s.nom','s.name_alias'), $search_nom); if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'"; if ($search_town) $sql .= natural_search('s.town', $search_town); if ($search_state) $sql .= natural_search('d.nom', $search_state); @@ -253,6 +252,10 @@ if ($socname) $sortfield = "s.nom"; $sortorder = "ASC"; } +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; // Count total nb of records $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -326,6 +329,9 @@ if ($resql) { print '
'; print $moreforfilter; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print '
'; } @@ -340,11 +346,13 @@ if ($resql) print_liste_field_titre($langs->trans("ProspectLevelShort"),$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("StatusProsp"),$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre(''); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre(''); - $parameters=array(); - $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre(''); print "\n"; @@ -404,6 +412,10 @@ if ($resql) print ' '; print ''; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print ''; @@ -413,10 +425,6 @@ if ($resql) print ''; print "\n"; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print "\n"; $i = 0; @@ -462,13 +470,15 @@ if ($resql) } print ''; - print ''; + $parameters=array('obj' => $obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print ''; print $prospectstatic->LibStatut($prospectstatic->status,3); print ''; - print ''; - $parameters=array('obj' => $obj); - $formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print ''; print "\n"; $i++; @@ -483,7 +493,8 @@ if ($resql) $db->free($resql); $parameters=array('sql' => $sql); - $formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; } else { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3aadf529843..0f4f826e27d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5037,10 +5037,10 @@ function dol_getmypid() * If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000" * If param $mode is 2, can contains a list of id separated by comma like "1,3,4" * @param integer $mode 0=value is list of keywords, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4') - * @param integer $nofinaland 1=Do now output the final 'AND' + * @param integer $nofirstand 1=Do now output the first 'AND' * @return string $res The statement to append to the SQL query */ -function natural_search($fields, $value, $mode=0, $nofinaland=0) +function natural_search($fields, $value, $mode=0, $nofirstand=0) { global $db,$langs; @@ -5107,7 +5107,7 @@ function natural_search($fields, $value, $mode=0, $nofinaland=0) if ($newres) $res = $res . ($res ? ' AND ' : '') . ($i2 > 1 ? '(' : '') .$newres . ($i2 > 1 ? ')' : ''); $j++; } - $res = ($nofinaland?"":" AND ")."(" . $res . ")"; + $res = ($nofirstand?"":" AND ")."(" . $res . ")"; //print 'xx'.$res.'yy'; return $res; } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index ef83701518c..66768696320 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1133,6 +1133,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu /* * Menu SUPPLIERS */ + /* if ($mainmenu == 'suppliers') { $langs->load("suppliers"); @@ -1173,6 +1174,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } } + */ /* * Menu PROJECTS diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 49fefc3ebed..dc90a7c3853 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -70,7 +70,7 @@ $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/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname'); $nbofsearch++; } diff --git a/htdocs/fourn/list.php b/htdocs/fourn/list.php index f5f4d4dc897..c473f89a3b1 100644 --- a/htdocs/fourn/list.php +++ b/htdocs/fourn/list.php @@ -105,7 +105,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.f foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; // Add fields from hooks $parameters=array(); -$result=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef ON ef.fk_object = s.rowid"; @@ -121,19 +121,9 @@ if ($socname) { $sortfield = "s.nom"; $sortorder = "ASC"; } -if ($search_name) { - $sql .= natural_search( - array( - 's.nom', - 's.name_alias' - ), - $search_name - ); -} +if ($search_name) $sql .= natural_search(array('s.nom', 's.name_alias'), $search_name); if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'"; -if ($search_town) { - $sql .= natural_search('s.town', $search_town); -} +if ($search_town) $sql .= natural_search('s.town', $search_town); if ($search_supplier_code) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_supplier_code)."%'"; if ($search_supplier_accounting) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_supplier_accounting)."%'"; if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; @@ -143,8 +133,9 @@ if ($search_categ > 0) $sql.= " AND cf.fk_categorie = ".$search_categ; if ($search_categ == -2) $sql.= " AND cf.fk_categorie IS NULL"; // Add where from hooks $parameters=array(); -$result=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; + // Count total nb of records $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -166,7 +157,7 @@ if ($resql) $param = "&search_name=".$search_name."&search_supplier_code=".$search_supplier_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town; if ($search_categ != '') $param.='&search_categ='.$search_categ; - print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); + print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies'); print '
'."\n"; @@ -183,6 +174,9 @@ if ($resql) { print '
'; print $moreforfilter; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print '
'; } @@ -229,7 +223,7 @@ if ($resql) print ''; print ''; - print "\n"; + print "\n"; print ''; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3d7da011d4a..1ccb594e472 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1526,7 +1526,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me 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/societe.php', DOL_URL_ROOT.'/societe/societe.php', $langs->trans("ThirdParties"), 'soc', 'socname', 'T', 'searchleftt', img_object('','company')); + $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'socname', 'T', 'searchleftt', img_object('','company')); } if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 3463f3d0a7a..e79310a5ab6 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -103,7 +103,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('projectlist')); - +$extrafields = new ExtraFields($db); @@ -124,6 +124,12 @@ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$min $sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.public, p.fk_user_creat"; $sql.= ", p.datec as date_create, p.dateo as date_start, p.datee as date_end"; $sql.= ", s.nom as name, s.rowid as socid"; +// Add fields for extrafields +foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; @@ -140,18 +146,9 @@ if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$pro // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; -if ($search_ref) -{ - $sql .= natural_search('p.ref', $search_ref); -} -if ($search_label) -{ - $sql .= natural_search('p.title', $search_label); -} -if ($search_societe) -{ - $sql .= natural_search('s.nom', $search_societe); -} +if ($search_ref) $sql .= natural_search('p.ref', $search_ref); +if ($search_label) $sql .= natural_search('p.title', $search_label); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($smonth > 0) { if ($syear > 0 && empty($sday)) @@ -178,17 +175,15 @@ else if ($year > 0) { $sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } -if ($search_all) -{ - $sql .= natural_search(array('p.ref','p.title','s.nom'), $search_all); -} +if ($search_all) $sql .= natural_search(array('p.ref','p.title','s.nom'), $search_all); if ($search_status >= 0) $sql .= " AND p.fk_statut = ".$db->escape($search_status); if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; -if ($search_user > 0) -{ - $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='project' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user; -} +if ($search_user > 0) $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='project' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); @@ -255,8 +250,9 @@ if ($resql) print '
'; print $moreforfilter; $parameters=array(); - $formconfirm=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - print '
'; + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; } @@ -270,10 +266,13 @@ if ($resql) if (! empty($conf->global->PROJECT_LIST_SHOW_STARTDATE)) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"p.dateo","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"p.datee","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"",$param,'align="right"',$sortfield,$sortorder); + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); - $parameters=array(); - $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print "\n"; print ''; @@ -309,15 +308,18 @@ if ($resql) print $form->selectarray('search_public',$array,$search_public); print ''; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('Draft'),'1'=>$langs->trans('Opened'),'2'=>$langs->trans('Closed')),$search_status); - print ''; + print ''; + print ''; print ''; print ''; print ''; - $parameters=array(); - $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook print ''."\n"; @@ -412,13 +414,14 @@ if ($resql) else print $langs->trans('PrivateProject'); print ''; + $parameters=array('obj' => $objp); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Status $projectstatic->statut = $objp->fk_statut; print ''.$projectstatic->getLibStatut(5).''; - $parameters=array('obj' => $objp); - $formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook - print "\n"; } @@ -429,7 +432,8 @@ if ($resql) $db->free($resql); $parameters=array('sql' => $sql); - $formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print "\n"; print "
\n"; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 383ed9e8ff8..b2b0f954a58 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -307,7 +307,7 @@ abstract class ActionsCardCommon if ($result >= 0) { - header("Location: ".DOL_URL_ROOT."/societe/societe.php?delsoc=".$this->object->name.""); + header("Location: ".DOL_URL_ROOT."/societe/list.php?delsoc=".$this->object->name.""); exit; } else diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index b03cb62eef0..12de6db7707 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -61,7 +61,7 @@ print '
'; */ $rowspan=2; if (! empty($conf->barcode->enabled)) $rowspan++; -print '
'; +print ''; print ''; print ''."\n"; print ''; diff --git a/htdocs/societe/societe.php b/htdocs/societe/list.php similarity index 86% rename from htdocs/societe/societe.php rename to htdocs/societe/list.php index 4e539c4236c..6f96729155d 100644 --- a/htdocs/societe/societe.php +++ b/htdocs/societe/list.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/societe/societe.php + * \file htdocs/societe/list.php * \ingroup societe * \brief Page to show list of third parties */ @@ -66,6 +66,10 @@ $offset = $conf->liste_limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('thirdpartylist')); +$extrafields = new ExtraFields($db); + /* * Actions @@ -181,7 +185,6 @@ if ($socname) */ /* REM: Regle sur droits "Voir tous les clients" - REM: Exemple, voir la page societe.php dans le mode liste. Utilisateur interne socid=0 + Droits voir tous clients => Voit toute societe Utilisateur interne socid=0 + Pas de droits voir tous clients => Ne voit que les societes liees comme commercial Utilisateur externe socid=x + Droits voir tous clients => Ne voit que lui meme @@ -196,6 +199,12 @@ $sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idpr if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; // We'll need these fields in order to filter by categ if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_soc"; +// Add fields for extrafields +foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."c_stcomm as st"; // We'll need this table joined to the select in order to filter by sale @@ -209,40 +218,11 @@ if ($socid) $sql.= " AND s.rowid = ".$socid; if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale if ($search_categ) $sql.= " AND s.rowid = cs.fk_soc"; // Join for the needed table to filter by categ if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible -// Insert sale filter -if ($search_sale) -{ - $sql .= " AND sc.fk_user = ".$db->escape($search_sale); -} -// Insert categ filter -if ($search_categ) -{ - $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ); -} -if ($search_nom_only) -{ - $sql.= " AND s.nom LIKE '%".$db->escape($search_nom_only)."%'"; -} -if ($search_all) -{ - $sql.= " AND ("; - $sql.= "s.nom LIKE '%".$db->escape($search_all)."%'"; - $sql.= " OR s.code_client LIKE '%".$db->escape($search_all)."%'"; - $sql.= " OR s.email LIKE '%".$db->escape($search_all)."%'"; - $sql.= " OR s.url LIKE '%".$db->escape($search_all)."%'"; - $sql.= " OR s.siren LIKE '%".$db->escape($search_all)."%'"; - $sql.= ")"; -} -if ($search_nom) -{ - $sql.= " AND ("; - $sql.= "s.nom LIKE '%".$db->escape($search_nom)."%'"; - $sql.= " OR s.code_client LIKE '%".$db->escape($search_nom)."%'"; - $sql.= " OR s.email LIKE '%".$db->escape($search_nom)."%'"; - $sql.= " OR s.url LIKE '%".$db->escape($search_nom)."%'"; - $sql.= " OR s.siren LIKE '%".$db->escape($search_nom)."%'"; - $sql.= ")"; -} +if ($search_sale) $sql .= " AND sc.fk_user = ".$db->escape($search_sale); +if ($search_categ) $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ); +if ($search_nom_only) $sql.= natural_search("s.nom",$search_nom_only); +if ($search_all) $sql.= natural_search(array("s.nom", "s.name_alias", "s.code_client", "s.code_fournisseur", "s.email", "s.url","s.siren","s.siret","s.ape","s.idprof4","s.idprof5","s.idprof6"), $search_all); +if ($search_nom) $sql.= natural_search(array("s.nom", "s.name_alias", "s.code_client", "s.code_fournisseur", "s.email", "s.url","s.siren","s.siret","s.ape","s.idprof4","s.idprof5","s.idprof6"), $search_nom); if ($search_town) $sql .= " AND s.town LIKE '%".$db->escape($search_town)."%'"; if ($search_idprof1) $sql .= " AND s.siren LIKE '%".$db->escape($search_idprof1)."%'"; if ($search_idprof2) $sql .= " AND s.siret LIKE '%".$db->escape($search_idprof2)."%'"; @@ -255,7 +235,10 @@ if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1"; if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; if (!empty($conf->barcode->enabled) && $sbarcode) $sql.= " AND s.barcode LIKE '%".$db->escape($sbarcode)."%'"; -//print $sql; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; // Count total nb of records $nbtotalofrecords = 0; @@ -281,7 +264,7 @@ if ($resql) $params.= '&search_idprof3='.htmlspecialchars($search_idprof3); $params.= '&search_idprof4='.htmlspecialchars($search_idprof4); - print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$params,$sortfield,$sortorder,'',$num,$nbtotalofrecords); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$params,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies'); // Show delete result message if (GETPOST('delsoc')) @@ -305,8 +288,6 @@ if ($resql) print ''; print ''; - print '
'; - // Filter on categories /* Not possible in this page because list is for ALL third parties type $moreforfilter=''; @@ -330,6 +311,17 @@ if ($resql) print ''; } */ + if (! empty($moreforfilter)) + { + print '
'; + print $moreforfilter; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; + } + + print '
'; // Lines of titles print ''; @@ -341,10 +333,13 @@ if ($resql) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$params,'class="nowrap"',$sortfield,$sortorder); print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$params,'class="nowrap"',$sortfield,$sortorder); print_liste_field_titre(''); + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$params,'align="right"',$sortfield,$sortorder); print "\n"; - // Lignes des champs de filtre + // Fields title search print ''; print ''; - // Status + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Status print ''; + + $parameters=array('obj' => $obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Status print ''; print ''."\n"; @@ -454,6 +460,10 @@ if ($resql) $db->free($resql); + $parameters=array('sql' => $sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print "
'; print ''; @@ -389,7 +384,12 @@ if ($resql) print ''; print ''; print ''; print ''; print '  '; @@ -446,6 +446,12 @@ if ($resql) } print $s; print ''.$companystatic->getLibStatut(3).'
"; print '
'; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index b46bec9201c..ae58f2d85c0 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -643,7 +643,7 @@ if (empty($reshook)) if ($result > 0) { - header("Location: ".DOL_URL_ROOT."/societe/societe.php?delsoc=".urlencode($object->name)); + header("Location: ".DOL_URL_ROOT."/societe/list.php?delsoc=".urlencode($object->name)); exit; } else From cac7b1f49fc58eff38d1264adae4368a1331e590 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Jun 2015 16:34:25 +0200 Subject: [PATCH 4/8] NEW Add hooks on list of members to allow an external module to add more fields into list view. --- htdocs/adherents/list.php | 102 +++++++++++++++++--------------- htdocs/langs/en_US/members.lang | 3 +- htdocs/societe/list.php | 28 ++++----- 3 files changed, 69 insertions(+), 64 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index ec8ff84b763..1cf2a8e5e09 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -73,6 +73,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $sall=""; } +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('memberlist')); +$extrafields = new ExtraFields($db); + /* * View @@ -91,6 +95,12 @@ $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, $sql.= " d.datefin,"; $sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,"; $sql.= " t.libelle as type, t.cotisation"; +// Add fields for extrafields +foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d"; if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ $sql.= ", ".MAIN_DB_PREFIX."adherent_type as t"; @@ -100,52 +110,23 @@ if ($catid == -2) $sql.= " AND cm.fk_categorie IS NULL"; if ($search_categ > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($search_categ); if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL"; $sql.= " AND d.entity IN (".getEntity('adherent', 1).")"; -if ($sall) -{ - // For natural search - $scrit = explode(' ', $sall); - foreach ($scrit as $crit) - { - $sql.=" AND ("; - if (is_numeric($sall)) $sql.= "d.rowid = ".$db->escape($sall)." OR "; - $sql.=" d.firstname LIKE '%".$db->escape($sall)."%' OR d.lastname LIKE '%".$db->escape($sall)."%' OR d.societe LIKE '%".$db->escape($sall)."%'"; - $sql.=" OR d.email LIKE '%".$db->escape($sall)."%' OR d.login LIKE '%".$db->escape($sall)."%' OR d.address LIKE '%".$db->escape($sall)."%'"; - $sql.=" OR d.town LIKE '%".$db->escape($sall)."%' OR d.note_public LIKE '%".$db->escape($sall)."%' OR d.note_private LIKE '%".$db->escape($sall)."%')"; - } -} -if ($type > 0) -{ - $sql.=" AND t.rowid=".$db->escape($type); -} -if (isset($_GET["statut"]) || isset($_POST["statut"])) -{ - $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules -} +if ($sall) $sql.=natural_search(array("d.rowid", "d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall); +if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type); +if (isset($_GET["statut"]) || isset($_POST["statut"])) $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules if ($search_ref) { if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")"; else $sql.=" AND 1 = 2"; // Always wrong } -if ($search_lastname) -{ - $sql.= " AND (d.firstname LIKE '%".$db->escape($search_lastname)."%' OR d.lastname LIKE '%".$db->escape($search_lastname)."%' OR d.societe LIKE '%".$db->escape($search_lastname)."%')"; -} -if ($search_login) -{ - $sql.= " AND d.login LIKE '%".$db->escape($search_login)."%'"; -} -if ($search_email) -{ - $sql.= " AND (d.email LIKE '%".$db->escape($search_email)."%')"; -} -if ($filter == 'uptodate') -{ - $sql.=" AND datefin >= '".$db->idate($now)."'"; -} -if ($filter == 'outofdate') -{ - $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')"; -} +if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname); +if ($search_login) $sql.= natural_search("d.login", $search_login); +if ($search_email) $sql.= natural_search("d.email", $search_email); +if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'"; +if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')"; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; // Count total nb of records with no order and no limits $nbtotalofrecords = 0; @@ -204,7 +185,7 @@ if ($resql) } print '
'; - print ""; + print ''; // Filter on categories $moreforfilter=''; @@ -215,14 +196,17 @@ if ($resql) $moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1); $moreforfilter.='       '; } - if ($moreforfilter) + if (! empty($moreforfilter)) { - print ''; - print ''; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; } + print "
'; + print '
'; print $moreforfilter; - print '
"; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); @@ -230,7 +214,12 @@ if ($resql) print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"t.libelle",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder); + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder); print "\n"; @@ -257,7 +246,12 @@ if ($resql) print ''; - print ''; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Status + print ''; print '\n"; - // Statut + $parameters=array('obj' => $obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Statut print '"; @@ -366,6 +364,12 @@ if ($resql) $i++; } + $db->free($resql); + + $parameters=array('sql' => $sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print "
'; print '  '; print ''; @@ -317,7 +311,11 @@ if ($resql) // EMail print "".dol_print_email($objp->email,0,0,1)."'; print $memberstatic->LibStatut($objp->statut,$objp->cotisation,$datefin,2); print "
\n"; print '
'; diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 3593e4c879f..daab8dcc3e5 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -199,7 +199,8 @@ Entreprises=Companies DOLIBARRFOUNDATION_PAYMENT_FORM=To make your subscription payment using a bank transfer, see page http://wiki.dolibarr.org/index.php/Subscribe.
To pay using a Credit Card or Paypal, click on button at bottom of this page.
ByProperties=By characteristics MembersStatisticsByProperties=Members statistics by characteristics -MembersByNature=Members by nature +MembersByNature=This screen show you statistics on members by nature. +MembersByRegion=This screen show you statistics on members by region. VATToUseForSubscriptions=VAT rate to use for subscriptions NoVatOnSubscription=No TVA for subscriptions MEMBER_PAYONLINE_SENDEMAIL=Email to warn when Dolibarr receive a confirmation of a validated payment for subscription diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 6f96729155d..1019e7ee167 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -214,22 +214,22 @@ if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql.= " WHERE s.fk_stcomm = st.id"; $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socid) $sql.= " AND s.rowid = ".$socid; -if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale -if ($search_categ) $sql.= " AND s.rowid = cs.fk_soc"; // Join for the needed table to filter by categ +if ($socid) $sql.= " AND s.rowid = ".$socid; +if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale +if ($search_categ) $sql.= " AND s.rowid = cs.fk_soc"; // Join for the needed table to filter by categ if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible -if ($search_sale) $sql .= " AND sc.fk_user = ".$db->escape($search_sale); -if ($search_categ) $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ); +if ($search_sale) $sql .= " AND sc.fk_user = ".$db->escape($search_sale); +if ($search_categ) $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ); if ($search_nom_only) $sql.= natural_search("s.nom",$search_nom_only); -if ($search_all) $sql.= natural_search(array("s.nom", "s.name_alias", "s.code_client", "s.code_fournisseur", "s.email", "s.url","s.siren","s.siret","s.ape","s.idprof4","s.idprof5","s.idprof6"), $search_all); -if ($search_nom) $sql.= natural_search(array("s.nom", "s.name_alias", "s.code_client", "s.code_fournisseur", "s.email", "s.url","s.siren","s.siret","s.ape","s.idprof4","s.idprof5","s.idprof6"), $search_nom); -if ($search_town) $sql .= " AND s.town LIKE '%".$db->escape($search_town)."%'"; -if ($search_idprof1) $sql .= " AND s.siren LIKE '%".$db->escape($search_idprof1)."%'"; -if ($search_idprof2) $sql .= " AND s.siret LIKE '%".$db->escape($search_idprof2)."%'"; -if ($search_idprof3) $sql .= " AND s.ape LIKE '%".$db->escape($search_idprof3)."%'"; -if ($search_idprof4) $sql .= " AND s.idprof4 LIKE '%".$db->escape($search_idprof4)."%'"; -if ($search_idprof5) $sql .= " AND s.idprof5 LIKE '%".$db->escape($search_idprof5)."%'"; -if ($search_idprof6) $sql .= " AND s.idprof6 LIKE '%".$db->escape($search_idprof6)."%'"; +if ($search_all) $sql.= natural_search(array("s.nom", "s.name_alias", "s.code_client", "s.code_fournisseur", "s.email", "s.url","s.siren","s.siret","s.ape","s.idprof4","s.idprof5","s.idprof6"), $search_all); +if ($search_nom) $sql.= natural_search(array("s.nom", "s.name_alias", "s.code_client", "s.code_fournisseur", "s.email", "s.url","s.siren","s.siret","s.ape","s.idprof4","s.idprof5","s.idprof6"), $search_nom); +if ($search_town) $sql .= " AND s.town LIKE '%".$db->escape($search_town)."%'"; +if ($search_idprof1) $sql .= " AND s.siren LIKE '%".$db->escape($search_idprof1)."%'"; +if ($search_idprof2) $sql .= " AND s.siret LIKE '%".$db->escape($search_idprof2)."%'"; +if ($search_idprof3) $sql .= " AND s.ape LIKE '%".$db->escape($search_idprof3)."%'"; +if ($search_idprof4) $sql .= " AND s.idprof4 LIKE '%".$db->escape($search_idprof4)."%'"; +if ($search_idprof5) $sql .= " AND s.idprof5 LIKE '%".$db->escape($search_idprof5)."%'"; +if ($search_idprof6) $sql .= " AND s.idprof6 LIKE '%".$db->escape($search_idprof6)."%'"; // Filter on type of thirdparty if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")"; if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1"; From bfa0f0d576436a7b6af4651207dc1ae141632dd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Jun 2015 17:20:06 +0200 Subject: [PATCH 5/8] Minor look enhancement --- htdocs/adherents/card.php | 16 +++++++++------- htdocs/core/class/html.form.class.php | 6 +++--- htdocs/theme/eldy/style.css.php | 4 +++- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 924d9bc4481..9a0fecba320 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -976,7 +976,6 @@ else $head = member_prepare_head($object); - dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); if ($conf->use_javascript_ajax) { @@ -1020,6 +1019,8 @@ else print ''; if ($backtopage) print ''; + dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); + print ''; // Ref @@ -1179,7 +1180,9 @@ else print '
'; - print '
'; + dol_fiche_end(); + + print '
'; print ''; print '     '; print ''; @@ -1187,7 +1190,6 @@ else print ''; - print '
'; } if ($rowid && $action != 'edit') @@ -1277,7 +1279,7 @@ else $texttosend=$object->makeSubstitution($adht->getMailOnValid()); $tmp=$langs->trans("SendAnEMailToMember"); - $tmp.=' ('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; + $tmp.='
('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; $tmp.=$langs->trans("MailRecipient").': '.$object->email.')'; $helpcontent=''; $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; @@ -1298,7 +1300,7 @@ else if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); } - print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1); + print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1); } // Confirm send card by mail @@ -1319,7 +1321,7 @@ else $texttosend=$object->makeSubstitution($adht->getMailOnResiliate()); $tmp=$langs->trans("SendAnEMailToMember"); - $tmp.=' ('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; + $tmp.='
('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; $tmp.=$langs->trans("MailRecipient").': '.$object->email.')'; $helpcontent=''; $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; @@ -1335,7 +1337,7 @@ else $formquestion=array(); if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false')); if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); - print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion); + print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion,'no',1); } // Confirm remove member diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 75f10d812f9..69d480888fe 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -404,7 +404,7 @@ class Form else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':'').($extrastyle?' style="'.$extrastyle.'"':''); // Attribut to put on td text tag $s=""; if (empty($notabs)) $s.=''; - elseif ($notabs == 2) $s.='
'; + elseif ($notabs == 2) $s.='
'; // Define value if value is before if ($direction < 0) { $s.='<'.$tag.$paramfortooltipimg; @@ -3212,9 +3212,9 @@ class Form // Show JQuery confirm box. Note that global var $useglobalvars is used inside this template $formconfirm.= '
'; +print '
'; print ''; } - // Categories + // Tags / categories if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { print ''; diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index 96febfcda9c..80f64e41561 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -2266,6 +2266,101 @@ div.jnotify-background { } +/* ============================================================================== */ +/* Select2 */ +/* ============================================================================== */ + +.selectoptiondisabledwhite { + background: #FFFFFF !important; +} + +.select2-choice, +.select2-drop.select2-drop-above.select2-drop-active, +.select2-container-active .select2-choice, +.select2-container-active .select2-choices, +.select2-dropdown-open.select2-drop-above .select2-choice, +.select2-dropdown-open.select2-drop-above .select2-choices, +.select2-container-multi.select2-container-active .select2-choices +{ + border: 1px solid #aaa; +} +.select2-disabled +{ + color: #888; +} +.select2-drop-active +{ + border: 1px solid #aaa; + border-top: none; +} +a span.select2-chosen +{ + font-weight: normal !important; +} +.select2-container .select2-choice { + background-image: none; + height: 24px; + line-height: 24px; +} +.select2-choices .select2-search-choice { + border: 1px solid #aaa !important; +} +.select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit +{ + background: #FFFFFF; +} +.select2-container-multi.select2-container-disabled .select2-choices { + background-color: #FFFFFF; + background-image: none; + border: none; + cursor: default; +} +.select2-container-multi .select2-choices .select2-search-choice { + margin-bottom: 3px; +} +/* To emulate select 2 style */ +.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr { + padding: 2px 5px 1px 5px; + margin: 0 0 2px 3px; + position: relative; + line-height: 13px; + color: #333; + cursor: default; + border: 1px solid #aaaaaa; + border-radius: 3px; + -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + background-clip: padding-box; + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-color: #e4e4e4; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee)); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); +} +.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr a { + font-weight: normal; +} +.select2-container-multi-dolibarr .select2-choices-dolibarr li { + float: left; + list-style: none; +} +.select2-container-multi-dolibarr .select2-choices-dolibarr { + height: auto !important; + height: 1%; + margin: 0; + padding: 0 5px 0 0; + position: relative; + cursor: text; + overflow: hidden; +} + + /* ============================================================================== */ /* JMobile */ /* ============================================================================== */ diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index ec652179ac1..d1dd0ab4091 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -2440,6 +2440,101 @@ div.ecmjqft { } +/* ============================================================================== */ +/* Select2 */ +/* ============================================================================== */ + +.selectoptiondisabledwhite { + background: #FFFFFF !important; +} + +.select2-choice, +.select2-drop.select2-drop-above.select2-drop-active, +.select2-container-active .select2-choice, +.select2-container-active .select2-choices, +.select2-dropdown-open.select2-drop-above .select2-choice, +.select2-dropdown-open.select2-drop-above .select2-choices, +.select2-container-multi.select2-container-active .select2-choices +{ + border: 1px solid #aaa; +} +.select2-disabled +{ + color: #888; +} +.select2-drop-active +{ + border: 1px solid #aaa; + border-top: none; +} +a span.select2-chosen +{ + font-weight: normal !important; +} +.select2-container .select2-choice { + background-image: none; + height: 24px; + line-height: 24px; +} +.select2-choices .select2-search-choice { + border: 1px solid #aaa !important; +} +.select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit +{ + background: #FFFFFF; +} +.select2-container-multi.select2-container-disabled .select2-choices { + background-color: #FFFFFF; + background-image: none; + border: none; + cursor: default; +} +.select2-container-multi .select2-choices .select2-search-choice { + margin-bottom: 3px; +} +/* To emulate select 2 style */ +.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr { + padding: 2px 5px 1px 5px; + margin: 0 0 2px 3px; + position: relative; + line-height: 13px; + color: #333; + cursor: default; + border: 1px solid #aaaaaa; + border-radius: 3px; + -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + background-clip: padding-box; + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-color: #e4e4e4; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee)); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); +} +.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr a { + font-weight: normal; +} +.select2-container-multi-dolibarr .select2-choices-dolibarr li { + float: left; + list-style: none; +} +.select2-container-multi-dolibarr .select2-choices-dolibarr { + height: auto !important; + height: 1%; + margin: 0; + padding: 0 5px 0 0; + position: relative; + cursor: text; + overflow: hidden; +} + + /* ============================================================================== */ /* JMobile */ /* ============================================================================== */ diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 41a7b6fef87..eee7afcb9c0 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -2625,6 +2625,101 @@ div.ecmjqft { } +/* ============================================================================== */ +/* Select2 */ +/* ============================================================================== */ + +.selectoptiondisabledwhite { + background: #FFFFFF !important; +} + +.select2-choice, +.select2-drop.select2-drop-above.select2-drop-active, +.select2-container-active .select2-choice, +.select2-container-active .select2-choices, +.select2-dropdown-open.select2-drop-above .select2-choice, +.select2-dropdown-open.select2-drop-above .select2-choices, +.select2-container-multi.select2-container-active .select2-choices +{ + border: 1px solid #aaa; +} +.select2-disabled +{ + color: #888; +} +.select2-drop-active +{ + border: 1px solid #aaa; + border-top: none; +} +a span.select2-chosen +{ + font-weight: normal !important; +} +.select2-container .select2-choice { + background-image: none; + height: 24px; + line-height: 24px; +} +.select2-choices .select2-search-choice { + border: 1px solid #aaa !important; +} +.select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit +{ + background: #FFFFFF; +} +.select2-container-multi.select2-container-disabled .select2-choices { + background-color: #FFFFFF; + background-image: none; + border: none; + cursor: default; +} +.select2-container-multi .select2-choices .select2-search-choice { + margin-bottom: 3px; +} +/* To emulate select 2 style */ +.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr { + padding: 2px 5px 1px 5px; + margin: 0 0 2px 3px; + position: relative; + line-height: 13px; + color: #333; + cursor: default; + border: 1px solid #aaaaaa; + border-radius: 3px; + -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + background-clip: padding-box; + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-color: #e4e4e4; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee)); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); +} +.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr a { + font-weight: normal; +} +.select2-container-multi-dolibarr .select2-choices-dolibarr li { + float: left; + list-style: none; +} +.select2-container-multi-dolibarr .select2-choices-dolibarr { + height: auto !important; + height: 1%; + margin: 0; + padding: 0 5px 0 0; + position: relative; + cursor: text; + overflow: hidden; +} + + /* ============================================================================== */ /* JMobile */ /* ============================================================================== */ diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index 640fea40575..4b8955953bd 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -195,7 +195,7 @@ legend { margin-bottom: 8px; } } .buttonRefused { pointer-events: none; - cursor: default; + cursor: default; opacity: 0.4; filter: alpha(opacity=40); /* For IE8 and earlier */ box-shadow: none; @@ -2505,6 +2505,102 @@ div.ecmjqft { background-image: none; } + +/* ============================================================================== */ +/* Select2 */ +/* ============================================================================== */ + +.selectoptiondisabledwhite { + background: #FFFFFF !important; +} + +.select2-choice, +.select2-drop.select2-drop-above.select2-drop-active, +.select2-container-active .select2-choice, +.select2-container-active .select2-choices, +.select2-dropdown-open.select2-drop-above .select2-choice, +.select2-dropdown-open.select2-drop-above .select2-choices, +.select2-container-multi.select2-container-active .select2-choices +{ + border: 1px solid #aaa; +} +.select2-disabled +{ + color: #888; +} +.select2-drop-active +{ + border: 1px solid #aaa; + border-top: none; +} +a span.select2-chosen +{ + font-weight: normal !important; +} +.select2-container .select2-choice { + background-image: none; + height: 24px; + line-height: 24px; +} +.select2-choices .select2-search-choice { + border: 1px solid #aaa !important; +} +.select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit +{ + background: #FFFFFF; +} +.select2-container-multi.select2-container-disabled .select2-choices { + background-color: #FFFFFF; + background-image: none; + border: none; + cursor: default; +} +.select2-container-multi .select2-choices .select2-search-choice { + margin-bottom: 3px; +} +/* To emulate select 2 style */ +.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr { + padding: 2px 5px 1px 5px; + margin: 0 0 2px 3px; + position: relative; + line-height: 13px; + color: #333; + cursor: default; + border: 1px solid #aaaaaa; + border-radius: 3px; + -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + background-clip: padding-box; + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-color: #e4e4e4; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee)); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); +} +.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr a { + font-weight: normal; +} +.select2-container-multi-dolibarr .select2-choices-dolibarr li { + float: left; + list-style: none; +} +.select2-container-multi-dolibarr .select2-choices-dolibarr { + height: auto !important; + height: 1%; + margin: 0; + padding: 0 5px 0 0; + position: relative; + cursor: text; + overflow: hidden; +} + + /* ============================================================================== */ /* JMobile */ /* ============================================================================== */ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0ab45e0d0d9..5eaa49a3072 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3394,8 +3394,50 @@ a span.select2-chosen cursor: default; } .select2-container-multi .select2-choices .select2-search-choice { - margin-bottom: 2px; + margin-bottom: 3px; } +/* To emulate select 2 style */ +.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr { + padding: 2px 5px 1px 5px; + margin: 0 0 2px 3px; + position: relative; + line-height: 13px; + color: #333; + cursor: default; + border: 1px solid #aaaaaa; + border-radius: 3px; + -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + background-clip: padding-box; + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-color: #e4e4e4; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee)); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); +} +.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr a { + font-weight: normal; +} +.select2-container-multi-dolibarr .select2-choices-dolibarr li { + float: left; + list-style: none; +} +.select2-container-multi-dolibarr .select2-choices-dolibarr { + height: auto !important; + height: 1%; + margin: 0; + padding: 0 5px 0 0; + position: relative; + cursor: text; + overflow: hidden; +} + /* ============================================================================== */ From 27cc7ef2b312f5148a3b4f9543ce783ec39c7ebb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2015 10:13:08 +0200 Subject: [PATCH 7/8] Time spent --- htdocs/admin/expensereport.php | 4 ++ htdocs/compta/deplacement/index.php | 6 +-- .../doc/pdf_standard.modules.php | 2 +- htdocs/expensereport/card.php | 47 ++++++++++--------- .../class/expensereport.class.php | 2 +- htdocs/expensereport/index.php | 6 +-- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/errors.lang | 1 + htdocs/langs/en_US/main.lang | 2 +- htdocs/langs/en_US/projects.lang | 1 + htdocs/langs/en_US/trips.lang | 1 + htdocs/projet/class/task.class.php | 8 ++-- htdocs/projet/element.php | 30 ++++++++++-- 13 files changed, 72 insertions(+), 40 deletions(-) diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index eb21636126a..15c810f46c5 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -146,6 +146,10 @@ if ($action == 'setModuleOptions') else if ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); + if ($ret > 0 && empty($conf->global->EXPENSEREPORT_ADDON_PDF)) + { + dolibarr_set_const($db, 'EXPENSEREPORT_ADDON_PDF', $value,'chaine',0,'',$conf->entity); + } } else if ($action == 'del') diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index 37a0f944bb3..b8920bb45a4 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2011 Regis Houssin * @@ -98,7 +98,7 @@ print '
'; // Statistics -print '
'.$langs->trans("Categories").''; if (! empty($conf->use_javascript_ajax)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 69d480888fe..331352812ca 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4608,7 +4608,7 @@ class Form * * @param int $id Id of object * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated. - * @param int $rendermode 0=Default, use multiselect. 1=Use text with link + * @param int $rendermode 0=Default, use multiselect. 1=Emulate multiselect * @return mixed Array of category objects or < 0 if KO */ function showCategories($id, $type, $rendermode=0) @@ -4626,10 +4626,10 @@ class Form $ways = $c->print_all_ways(); foreach($ways as $way) { - $toprint[] = img_object('','category').' '.$way; + $toprint[] = '
  • '.img_object('','category').' '.$way.'
  • '; } } - return implode('
    ', $toprint); + return '
      '.implode(' ', $toprint).'
    '; } if ($rendermode == 0) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index ae58f2d85c0..c4e95abcb8e 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -2204,7 +2204,7 @@ else print '
    ' . $langs->trans( "Categories" ) . '
    '; +print '
    '; print ''; print ''; print "\n"; @@ -111,7 +111,7 @@ foreach ($listoftype as $code => $label) if ($conf->use_javascript_ajax) { - print ''; diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 641ceb43e8f..eefeec44b2f 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -358,7 +358,7 @@ class pdf_standard extends ModeleExpenseReport // Total with all taxes $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($this->postotalttc-2, $curY); + $pdf->SetXY($this->postotalttc-1, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R'); $nexY+=5; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 0b688790af7..5dbd4635d12 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -46,6 +46,7 @@ $date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth'), GETPOST('date_debu $date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth'), GETPOST('date_finday'), GETPOST('date_finyear')); $date = dol_mktime(0, 0, 0, GETPOST('datemonth'), GETPOST('dateday'), GETPOST('dateyear')); $fk_projet=GETPOST('fk_projet'); +$vatrate=GETPOST('vatrate'); $ref=GETPOST("ref",'alpha'); // If socid provided by ajax company selector @@ -175,7 +176,7 @@ if ($action == 'update' && $user->rights->expensereport->creer) } } -if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) +if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) { $object = new ExpenseReport($db); $object->fetch($id); @@ -217,6 +218,8 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user if ($emailTo && $emailFrom) { + $filename=array(); $filedir=array(); $mimetype=array(); + // SUBJECT $subject = $langs->trans("ExpenseReportWaitingForApproval"); @@ -231,7 +234,6 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user if($resultPDF): // ATTACHMENT - $filename=array(); $filedir=array(); $mimetype=array(); array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref).".pdf"); array_push($mimetype,"application/pdf"); @@ -257,7 +259,7 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user if ($mailfile->error) { $mesg=''; - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); $mesg.='
    '.$mailfile->error; setEventMessage($mesg,'errors'); } @@ -845,7 +847,7 @@ if ($action == "addline") $object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees'); $object_ligne->fk_c_tva = GETPOST('fk_c_tva'); - $object_ligne->vatrate = price2num(GETPOST('vatrate')); + $object_ligne->vatrate = price2num($vatrate); $object_ligne->fk_projet = $fk_projet; @@ -890,10 +892,10 @@ if ($action == "addline") { $object_ligne->fk_expensereport = $_POST['fk_expensereport']; - $type = 0; // TODO What if service + $type = 0; // TODO What if service ? $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type); - $object_ligne->vatrate = price2num(GETPOST('vatrate')); + $object_ligne->vatrate = price2num($vatrate); $object_ligne->total_ttc = $tmp[2]; $object_ligne->total_ht = $tmp[0]; $object_ligne->total_tva = $tmp[1]; @@ -1337,7 +1339,7 @@ else dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip'); if ($action == 'save'): - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save","","",1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1); if ($ret == 'html') print '
    '; endif; @@ -1413,6 +1415,7 @@ else print ''; print ''; print ''; + print ''; print ''; print ''; @@ -1451,20 +1454,6 @@ else print ''; print ''; print ''; - if($object->fk_statut==6) - { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } // User to inform if($object->fk_statut<3) // informed @@ -1536,6 +1525,22 @@ else print ''; print ''; } + + if($object->fk_statut==6) + { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + print '
    '.$langs->trans("Statistics").'
    '; + print '
    '; $data=array('series'=>$dataseries); dol_print_graph('stats',300,180,$data,1,'pie',1); print '
    '.$langs->trans("Statut").''.$object->getLibStatut(4).'
    '.$langs->trans("NotePublic").''.$object->note_public.''.$langs->trans("DATE_SAVE").''.dol_print_date($object->date_create,'dayhour').'
    '.$langs->trans("AUTHORPAIEMENT").''; - $userfee=new User($db); - $userfee->fetch($object->fk_user_paid); - print $userfee->getNomUrl(1); - print '
    '.$langs->trans("DATE_PAIEMENT").''.$object->date_paiement.'
    '.$langs->trans("AUTHORPAIEMENT").''; + $userfee=new User($db); + $userfee->fetch($object->fk_user_paid); + print $userfee->getNomUrl(1); + print '
    '.$langs->trans("DATE_PAIEMENT").''.$object->date_paiement.'
    '; print '
    '; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 98a6aea00e7..9be10765a0a 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -110,7 +110,7 @@ class ExpenseReport extends CommonObject // List of language codes for status $this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); - $this->statuts = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); + $this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); $this->statuts_logo = array(0 => 'statut0', 2 => 'statut1', 4 => 'statut5', 5 => 'statut3', 6 => 'statut6', 99 => 'statut8'); return 1; diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index 5b157f6df8b..e98921362ff 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2011 Regis Houssin * @@ -70,13 +70,11 @@ $totalnb=$totalsum=0; $sql = "SELECT tf.code, tf.label, count(de.rowid) as nb, sum(de.total_ht) as km"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."expensereport_det as de, ".MAIN_DB_PREFIX."c_type_fees as tf"; $sql.= " WHERE de.fk_expensereport = d.rowid AND de.fk_c_type_fees = tf.id"; - // RESTRICT RIGHTS if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) { $sql.= " AND d.fk_user_author IN (".join(',',$childids).")\n"; } - $sql.= " GROUP BY tf.code, tf.label"; $result = $db->query($sql); @@ -202,7 +200,7 @@ if ($result) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '
    '; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 163267ff52f..8fcf0a4eb08 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -501,7 +501,7 @@ Module600Name=Notifications Module600Desc=Send EMail notifications on some Dolibarr business events to third-party contacts (setup defined on each thirdparty) Module700Name=Donations Module700Desc=Donation management -Module770Name=Expense Report +Module770Name=Expense reports Module770Desc=Management and claim expense reports (transportation, meal, ...) Module1120Name=Supplier commercial proposal Module1120Desc=Request supplier commercial proposal and prices diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 9a878366bc7..8b935e8cc18 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -191,3 +191,4 @@ WarningNotRelevant=Irrelevant operation for this dataset WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when display setup is optimized for blind person or text browsers. WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice date (%s) for invoice %s. WarningTooManyDataPleaseUseMoreFilters=Too many data. Please use more filters +WarningSomeLinesWithNullHourlyRate=Some times were recorded by users when their hourly rate was not defined. A value of 0 was used but this may result in wrong valuation of time spent. diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ae766c7a147..d37f437364e 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -302,7 +302,7 @@ UnitPriceTTC=Unit price PriceU=U.P. PriceUHT=U.P. (net) AskPriceSupplierUHT=U.P. net Requested -PriceUTTC=U.P. +PriceUTTC=U.P. (inc. tax) Amount=Amount AmountInvoice=Invoice amount AmountPayment=Payment amount diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 25db18df474..8b9291d9501 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -77,6 +77,7 @@ ListExpenseReportsAssociatedProject=List of expense reports associated with the ListDonationsAssociatedProject=List of donations associated with the project ListActionsAssociatedProject=List of events associated with the project ListTaskTimeUserProject=List of time consumed on tasks of project +TaskTimeUserProject=Time consumed on tasks of project ActivityOnProjectThisWeek=Activity on project this week ActivityOnProjectThisMonth=Activity on project this month ActivityOnProjectThisYear=Activity on project this year diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index d4e4e8c4359..969ceaa01d6 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -76,6 +76,7 @@ BROUILLONNER=Reopen SendToValid=Sent on approval ModifyInfoGen=Edit ValidateAndSubmit=Validate and submit for approval +ValidatedWaitingApproval=Validated (waiting for approval) NOT_VALIDATOR=You are not allowed to approve this expense report NOT_AUTHOR=You are not the author of this expense report. Operation cancelled. diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 3b2caf30ad7..bd20a930aa4 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -930,7 +930,7 @@ class Task extends CommonObject $result=array(); $sql = "SELECT"; - $sql.= " SUM(t.task_duration / 3600 * thm) as amount"; + $sql.= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as amount, SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql.= " WHERE t.fk_task = ".$id; if (is_object($fuser) && $fuser->id > 0) @@ -947,7 +947,8 @@ class Task extends CommonObject $datefieldname="task_datehour"; $sql.=" AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)"; } - + //print $sql; + dol_syslog(get_class($this)."::getSumOfAmount", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -955,7 +956,8 @@ class Task extends CommonObject $obj = $this->db->fetch_object($resql); $result['amount'] = $obj->amount; - + $result['nblinesnull'] = $obj->nblinesnull; + $this->db->free($resql); return $result; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index a9089673ae6..c044d309322 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -463,7 +463,11 @@ foreach ($listofreferent as $key => $value) } else { - if ($element instanceof Task) print $element->getNomUrl(1,'withproject','time'); + if ($element instanceof Task) + { + print $element->getNomUrl(1,'withproject','time'); + print ' - '.dol_trunc($element->label, 48); + } else print $element->getNomUrl(1); $element_doc = $element->element; @@ -522,13 +526,19 @@ foreach ($listofreferent as $key => $value) print ''; // Amount without tax + $warning=''; if (empty($value['disableamount'])) { if ($tablename == 'don') $total_ht_by_line=$element->amount; elseif ($tablename == 'projet_task') { - $tmp = $element->getSumOfAmount($elementuser, $dates, $datee); + $tmp = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty $total_ht_by_line = price2num($tmp['amount'],'MT'); + if ($tmp['nblinesnull'] > 0) + { + $langs->load("errors"); + $warning=$langs->trans("WarningSomeLinesWithNullHourlyRate"); + } } else { @@ -538,6 +548,7 @@ foreach ($listofreferent as $key => $value) if (! $qualifiedfortotal) print ''; print (isset($total_ht_by_line)?price($total_ht_by_line):' '); if (! $qualifiedfortotal) print ''; + if ($warning) print ' '.img_warning($warning); print ''; } else print ''; @@ -559,13 +570,18 @@ foreach ($listofreferent as $key => $value) if (! $qualifiedfortotal) print ''; print (isset($total_ttc_by_line)?price($total_ttc_by_line):' '); if (! $qualifiedfortotal) print ''; + if ($warning) print ' '.img_warning($warning); print ''; } else print ''; // Status print ''; - if ($element instanceof CommonInvoice) + if ($tablename == 'expensereport_det') + { + print $expensereport->getLibStatut(5); + } + else if ($element instanceof CommonInvoice) { //This applies for Facture and FactureFournisseur print $element->getLibStatut(5, $element->getSommePaiement()); @@ -694,6 +710,7 @@ print ''.$langs->trans("AmountHT").''; print ''.$langs->trans("AmountTTC").''; print ''; +$var=true; foreach ($listofreferent as $key => $value) { $name=$langs->trans($value['name']); @@ -710,7 +727,6 @@ foreach ($listofreferent as $key => $value) $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee); if (count($elementarray)>0 && is_array($elementarray)) { - $var=true; $total_ht = 0; $total_ttc = 0; @@ -793,11 +809,15 @@ foreach ($listofreferent as $key => $value) case 'Contrat': $newclassname = 'Contract'; break; + case 'Task': + $newclassname = 'TaskTimeUserProject'; + break; default: $newclassname = $classname; } - print ''; + $var = ! $var; + print ''; // Module print ''.$langs->trans($newclassname).''; // Nb From a23e2511b96bb6049da1b6a9d6203a49c0bc0917 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2015 18:11:21 +0200 Subject: [PATCH 8/8] Removed useless tab --- htdocs/contact/card.php | 10 ++- htdocs/contact/exportimport.php | 112 -------------------------------- htdocs/core/lib/contact.lib.php | 5 -- 3 files changed, 9 insertions(+), 118 deletions(-) delete mode 100644 htdocs/contact/exportimport.php diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 742378a2db3..96b04753247 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke @@ -1092,6 +1092,14 @@ else else print $langs->trans("NoDolibarrAccess"); print ''; + print ''; + print $langs->trans("ExportCardToFormat").''; + print ''; + print img_picto($langs->trans("VCard"),'vcard.png').' '; + print $langs->trans("VCard"); + print ''; + print ''; + print ""; print dol_fiche_end(); diff --git a/htdocs/contact/exportimport.php b/htdocs/contact/exportimport.php deleted file mode 100644 index e9e9c70966c..00000000000 --- a/htdocs/contact/exportimport.php +++ /dev/null @@ -1,112 +0,0 @@ - - * Copyright (C) 2006-2012 Regis Houssin - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/contact/exportimport.php - * \ingroup societe - * \brief Onglet exports-imports d'un contact - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; - -$langs->load("companies"); - -// Security check -$id = GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); - - -/* - * View - */ - -$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); - -llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'); - -$form = new Form($db); - -$contact = new Contact($db); -$contact->fetch($id, $user); - - -$head = contact_prepare_head($contact); - -dol_fiche_head($head, 'exportimport', $title, 0, 'contact'); - - -/* - * Fiche en mode visu - */ -print ''; - -$linkback = ''.$langs->trans("BackToList").''; - -// Ref -print ''; - -// Name -print ''; -print ''; - -// Company -if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) -{ - if ($contact->socid > 0) - { - $objsoc = new Societe($db); - $objsoc->fetch($contact->socid); - - print ''; - } - else - { - print ''; - } -} - -// Civility -print ''; - -print '
    '.$langs->trans("Ref").''; -print $form->showrefnav($contact, 'id', $linkback); -print '
    '.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$contact->lastname.''.$langs->trans("Firstname").''.$contact->firstname.'
    '.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).'
    '.$langs->trans("ThirdParty").''; - print $langs->trans("ContactNotLinkedToCompany"); - print '
    '.$langs->trans("UserTitle").''; -print $contact->getCivilityLabel(); -print '
    '; - -print '
    '; - -print '
    '; - -print $langs->trans("ExportCardToFormat").': '; -print ''; -print img_picto($langs->trans("VCard"),'vcard.png').' '; -print $langs->trans("VCard"); -print ''; - - - - -$db->close(); - -llxFooter(); diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 3a50b79edd7..6ffabc61fc9 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -57,11 +57,6 @@ function contact_prepare_head(Contact $object) $head[$tab][2] = 'perso'; $tab++; - $head[$tab][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$object->id; - $head[$tab][1] = $langs->trans("ExportImport"); - $head[$tab][2] = 'exportimport'; - $tab++; - // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab