From 0934860ce5b5f7328373949b941975892e76e1e7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 21 Jun 2015 08:26:42 +0200 Subject: [PATCH 01/11] Accountancy list: Use print_liste_field_titre --- htdocs/accountancy/customer/lines.php | 18 +------ htdocs/accountancy/supplier/lines.php | 68 ++++++++++++--------------- 2 files changed, 33 insertions(+), 53 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index fa549487fbb..2bbb839459f 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -106,20 +106,6 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched")); -$page = GETPOST("page"); -if ($page < 0) - $page = 0; - -if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { - $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; -} elseif ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { - $limit = $conf->liste_limit; -} else { - $limit = $conf->liste_limit; -} - -$offset = $limit * $page; - $sql = "SELECT l.rowid , f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.qty, l.tva_tx, l.fk_code_ventilation, aa.label, aa.account_number,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; @@ -170,7 +156,7 @@ if ($result) { print ''; print ''; - print_liste_field_titre($langs->trans("Invoices"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder); @@ -181,7 +167,7 @@ if ($result) { print_liste_field_titre(''); print "\n"; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 0edc9e1142f..9d9aa3814b3 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -46,6 +46,18 @@ $search_desc = GETPOST('search_desc','alpha'); $search_amount = GETPOST('search_amount','alpha'); $search_account = GETPOST('search_account','alpha'); +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); + +if ($page == -1) { $page = 0; } +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +$limit = $conf->liste_limit; +if (! $sortfield) $sortfield="f.facnumber"; +if (! $sortorder) $sortorder="DESC"; + // Security check if ($user->societe_id > 0) accessforbidden(); @@ -95,20 +107,6 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { llxHeader('', $langs->trans("SuppliersVentilation") . ' - ' . $langs->trans("Dispatched")); -$page = GETPOST("page"); -if ($page < 0) - $page = 0; - -if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { - $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; -} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { - $limit = $conf->liste_limit; -} else { - $limit = $conf->liste_limit; -} - -$offset = $limit * $page; - $sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht , l.qty, l.rowid, l.tva_tx, aa.label, aa.account_number, "; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; @@ -138,12 +136,8 @@ if (strlen(trim($search_account))) { if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")"; } - -$sql .= " ORDER BY l.rowid"; -if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { - $sql .= " DESC "; -} -$sql .= $db->plimit($limit + 1, $offset); +$sql.= $db->order($sortfield,$sortorder); +$sql.= $db->plimit($limit + 1,$offset); dol_syslog('accountancy/supplier/lines.php::list sql= ' . $sql1); $result = $db->query($sql); @@ -152,7 +146,6 @@ if ($result) { $num_lines = $db->num_rows($result); $i = 0; - // TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list... print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); print '' . $langs->trans("DescVentilDoneSupplier") . ''; @@ -160,29 +153,30 @@ if ($result) { print '
'; print ''; - print '

'. $langs->trans("ChangeAccount"); + print '

'. $langs->trans("ChangeAccount") . '
'; print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1); print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre(''); + print_liste_field_titre(''); + print_liste_field_titre(''); print "\n"; - - print ''; + + print ''; print ''; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; + print '\n"; @@ -215,8 +209,8 @@ if ($result) { print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; 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 ''; -$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 '\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 ''; @@ -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 ''; print ''; print ''; - 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 ''; + + 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 "
' . $langs->trans("Invoice") . '' . $langs->trans("Ref") . '' . $langs->trans("Label") . '' . $langs->trans("Description") . '' . $langs->trans("Amount") . '' . $langs->trans("Account") . '  
  '; + print ' '; print ''; print "
' . dol_trunc($objp->product_label, 24) . '' . nl2br(dol_trunc($objp->description, 32)) . '' . price($objp->total_ht) . '' . $codeCompta . '' . price($objp->total_ht) . '' . $codeCompta . '' . $objp->rowid . ''; print img_edit(); From 0f450edfcd339f92162a3349682edb990b6e4a3d Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 21 Jun 2015 08:32:37 +0200 Subject: [PATCH 02/11] Debug --- htdocs/accountancy/supplier/lines.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 9d9aa3814b3..2ce07690f8e 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -55,7 +55,7 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; $limit = $conf->liste_limit; -if (! $sortfield) $sortfield="f.facnumber"; +if (! $sortfield) $sortfield="f.ref"; if (! $sortorder) $sortorder="DESC"; // Security check @@ -173,8 +173,8 @@ if ($result) { print ' '; print ''; From 2ab454e7571389d33735c121c810f3ea6ade3bd7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 21 Jun 2015 14:32:00 +0200 Subject: [PATCH 03/11] Presentation --- htdocs/accountancy/supplier/lines.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 2ce07690f8e..917ee15f1d4 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -173,7 +173,7 @@ if ($result) { print ' '; From 7d1d1caf30dbf12b9b9a4139a7fa27cc0e684f1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Jun 2015 17:09:00 +0200 Subject: [PATCH 04/11] Debug withdraw module --- htdocs/compta/prelevement/create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 8dc81bcffd5..64ec4ad1895 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -106,7 +106,7 @@ $h++; dol_fiche_head($head, $hselected, $langs->trans("StandingOrders"), 0, 'payment'); */ -print_barre_liste($langs->trans("NewStandingOrder"), 0, $_SERVER["PHP_SELF"]); +print_fiche_titre($langs->trans("NewStandingOrder")); dol_fiche_head(); From 5975536fcf7a8b73c004fb3bbd8eab85cca3bbc1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Jun 2015 23:25:01 +0200 Subject: [PATCH 05/11] Support type of leave. --- htdocs/holiday/card.php | 113 ++++++++++++++++--------- htdocs/holiday/class/holiday.class.php | 28 +++--- htdocs/langs/en_US/holiday.lang | 1 + 3 files changed, 92 insertions(+), 50 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 308bbac2661..1a430ab84cf 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -51,7 +51,6 @@ $now=dol_now(); * Actions */ -// Si création de la demande if ($action == 'create') { $cp = new Holiday($db); @@ -66,12 +65,15 @@ if ($action == 'create') if (! $error) { + $db->begin(); + $date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); $date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1); $date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1); $starthalfday=GETPOST('starthalfday'); $endhalfday=GETPOST('endhalfday'); + $type=GETPOST('type'); $halfday=0; if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2; else if ($starthalfday == 'afternoon') $halfday=-1; @@ -131,17 +133,22 @@ if ($action == 'create') $cp->date_fin = $date_fin; $cp->fk_validator = $valideur; $cp->halfday = $halfday; + $cp->fk_type = $type; - $verif = $cp->create($userid); + $verif = $cp->create($user); // Si pas d'erreur SQL on redirige vers la fiche de la demande if ($verif > 0) { - header('Location: card.php?id='.$verif); + $db->commit(); + + header('Location: card.php?id='.$verif); exit; } else - { + { + $db->rollback(); + // Sinon on affiche le formulaire de demande avec le message d'erreur SQL header('Location: card.php?action=request&error=SQL_Create&msg='.$cp->error); exit; @@ -242,44 +249,41 @@ if ($action == 'update') } // Si suppression de la demande -if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes') +if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights->holiday->delete) { - if($user->rights->holiday->delete) - { - $error=0; + $error=0; - $db->begin(); + $db->begin(); - $cp = new Holiday($db); - $cp->fetch($id); + $cp = new Holiday($db); + $cp->fetch($id); - $canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all)); + $canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all)); - // Si c'est bien un brouillon - if ($cp->statut == 1 || $cp->statut == 3) - { - // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer - if ($canedit) - { - $result=$cp->delete($id); - } - else - { - $error = $langs->trans('ErrorCantDeleteCP'); - } - } + // Si c'est bien un brouillon + if ($cp->statut == 1 || $cp->statut == 3) + { + // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer + if ($canedit) + { + $result=$cp->delete($id); + } + else + { + $error = $langs->trans('ErrorCantDeleteCP'); + } + } - if (! $error) - { - $db->commit(); - header('Location: index.php'); - exit; - } - else - { - $db->rollback(); - } - } + if (! $error) + { + $db->commit(); + header('Location: index.php'); + exit; + } + else + { + $db->rollback(); + } } // Si envoi de la demande @@ -466,7 +470,7 @@ if ($action == 'confirm_valid') if ($action == 'confirm_refuse') { - if (!empty($_POST['detail_refuse'])) + if (! empty($_POST['detail_refuse'])) { $cp = new Holiday($db); $cp->fetch($_GET['id']); @@ -770,6 +774,8 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print ''; print ''; + + // User print ''; print ''; print ''; print ''; + + // Type + print ''; + print ''; + print ''; + print ''; + + // Date start print ''; print ''; print ''; print ''; + + // Date end print ''; print ''; print '
'.$langs->trans("User").''; @@ -781,6 +787,24 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create else print $form->select_users(GETPOST('userid')?GETPOST('userid'):$user->id,'userid',0,'',0); print '
'.$langs->trans("Type").''; + $typeleaves=$cp->getTypes(1,1); + $arraytypeleaves=array(); + foreach($typeleaves as $key => $val) + { + $labeltoshow = $val['label']; + $labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); + $arraytypeleaves[$val['rowid']]=$labeltoshow; + } + print $form->selectarray('type', $arraytypeleaves, (GETPOST('type')?GETPOST('type'):''), 1); + print '
'.$langs->trans("DateDebCP").' ('.$langs->trans("FirstDayOfHoliday").')'; @@ -795,6 +819,8 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):'morning')); print '
'.$langs->trans("DateFinCP").' ('.$langs->trans("LastDayOfHoliday").')'; @@ -952,9 +978,9 @@ else if ($action == 'edit' && $cp->statut == 1) { $edit = true; - print ''."\n"; + print ''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; } print ''; @@ -974,6 +1000,15 @@ else print $userRequest->getNomUrl(1); print ''; + // Type + print ''; + print ''; + print ''; + print ''; + $starthalfday=($cp->halfday == -1 || $cp->halfday == 2)?'afternoon':'morning'; $endhalfday=($cp->halfday == 1 || $cp->halfday == 2)?'morning':'afternoon'; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 6743ce102a7..6e447d8cb95 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -53,7 +53,7 @@ class Holiday extends CommonObject var $date_debut_gmt=''; // Date start in GMT var $date_fin_gmt=''; // Date end in GMT var $halfday=''; - var $statut=''; // 1=draft, 2=validated, 3=approved + var $statut=''; // 1=draft, 2=validated, 3=approved var $fk_validator; var $date_valid=''; var $fk_user_valid; @@ -62,6 +62,7 @@ class Holiday extends CommonObject var $date_cancel=''; var $fk_user_cancel; var $detail_refuse=''; + var $fk_type; var $holiday = array(); var $events = array(); @@ -71,6 +72,7 @@ class Holiday extends CommonObject var $optValue = ''; var $optRowid = ''; + /** * Constructor * @@ -124,10 +126,10 @@ class Holiday extends CommonObject $sql.= "date_fin,"; $sql.= "halfday,"; $sql.= "statut,"; - $sql.= "fk_validator"; + $sql.= "fk_validator,"; + $sql.= "fk_type,"; + $sql.= "fk_user_create"; $sql.= ") VALUES ("; - - // User $sql.= "'".$this->fk_user."',"; $sql.= " '".$this->db->idate($now)."',"; $sql.= " '".$this->db->escape($this->description)."',"; @@ -135,8 +137,9 @@ class Holiday extends CommonObject $sql.= " '".$this->db->idate($this->date_fin)."',"; $sql.= " ".$this->halfday.","; $sql.= " '1',"; - $sql.= " '".$this->fk_validator."'"; - + $sql.= " '".$this->fk_validator."',"; + $sql.= " '".$this->fk_type."',"; + $sql.= " ".$user->id; $sql.= ")"; $this->db->begin(); @@ -150,7 +153,6 @@ class Holiday extends CommonObject if (! $error) { $this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."holiday"); - } // Commit or rollback @@ -200,7 +202,9 @@ class Holiday extends CommonObject $sql.= " cp.fk_user_cancel,"; $sql.= " cp.detail_refuse,"; $sql.= " cp.note_private,"; - $sql.= " cp.note_public"; + $sql.= " cp.note_public,"; + $sql.= " cp.fk_user_create,"; + $sql.= " cp.fk_type"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp"; $sql.= " WHERE cp.rowid = ".$id; @@ -213,8 +217,8 @@ class Holiday extends CommonObject $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; - $this->rowid = $obj->rowid; // deprecated - $this->ref = $obj->rowid; + $this->rowid = $obj->rowid; // deprecated + $this->ref = $obj->rowid; $this->fk_user = $obj->fk_user; $this->date_create = $this->db->jdate($obj->date_create); $this->description = $obj->description; @@ -234,6 +238,8 @@ class Holiday extends CommonObject $this->detail_refuse = $obj->detail_refuse; $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; + $this->fk_user_create = $obj->fk_user_create; + $this->fk_type = $obj->fk_type; } $this->db->free($resql); @@ -1841,7 +1847,7 @@ class Holiday extends CommonObject { while ($obj = $this->db->fetch_object($result)) { - $types[] = array('rowid'=> $obj->rowid, 'code'=> $obj->code, 'label'=>$obj->label, 'affect'=>$obj->affect, 'delay'=>$obj->delay, 'newByMonth'=>$obj->newByMonth); + $types[$obj->rowid] = array('rowid'=> $obj->rowid, 'code'=> $obj->code, 'label'=>$obj->label, 'affect'=>$obj->affect, 'delay'=>$obj->delay, 'newByMonth'=>$obj->newByMonth); } return $types; diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index b693c594f87..f9d9f047411 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -127,6 +127,7 @@ ErrorMailNotSend=An error occurred while sending email: NoCPforMonth=No leave this month. nbJours=Number days TitleAdminCP=Configuration of Leaves +NoticePeriod=Notice period #Messages Hello=Hello HolidaysToValidate=Validate leave requests 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 06/11] 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 07/11] 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 '
"; 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 '
'.$langs->trans("Type").''; + $typeleaves=$cp->getTypes(1,1); + print $typeleaves[$cp->fk_type]['label']; + 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 "
'; + 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 ''; print '
'; @@ -228,7 +229,8 @@ print '
'; 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 08/11] 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 "
'; print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print '
'.$obj->code_client.''.$obj->code_compta.''.dol_print_date($db->jdate($obj->datec),'day').''.$thirdpartystatic->getLibStatut(3); - print ''.$thirdpartystatic->getLibStatut(3); + 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 09/11] 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 10/11] 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; +} + /* ============================================================================== */
'.$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" ) . '