From 0de77fa4608692e73c769aed2b9758d8be5668c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Apr 2017 09:55:45 +0200 Subject: [PATCH] Fix look and feel v6 --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/adherents/list.php | 21 +++- htdocs/adherents/subscription/list.php | 132 +++++++++++++++------- 3 files changed, 109 insertions(+), 46 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index f3dfd857973..020dbc58474 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1577,7 +1577,7 @@ class Adherent extends CommonObject * @param string $morecss Add more css on link * @return string Chaine avec URL */ - function getNomUrl($withpictoimg=0,$maxlen=0,$option='card',$mode='ref',$morecss='') + function getNomUrl($withpictoimg=0,$maxlen=0,$option='card',$mode='',$morecss='') { global $conf, $langs; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index bf3d61cd6f2..e3aad3c4ccc 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -170,6 +170,7 @@ if (empty($reshook)) $catid=""; $sall=""; $statut=''; + $toselect=''; $search_array_options=array(); } } @@ -270,6 +271,8 @@ if (! $resql) $num = $db->num_rows($resql); +$arrayofselected=is_array($toselect)?$toselect:array(); + if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { $obj = $db->fetch_object($resql); @@ -333,7 +336,15 @@ foreach ($search_array_options as $key => $val) if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } -//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); +// List of mass actions available +$arrayofmassactions = array( +// 'presend'=>$langs->trans("SendByMail"), +// 'builddoc'=>$langs->trans("PDFMerge"), +); +//if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); +if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); +//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); print '
'; if ($optioncss != '') print ''; @@ -342,8 +353,9 @@ print ''; print ''; print ''; +print ''; -print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); +print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); if ($sall) { @@ -374,6 +386,7 @@ if (! empty($moreforfilter)) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); print '
'; print ''."\n"; @@ -547,7 +560,7 @@ if (! empty($arrayfields['d.statut']['checked'])) } // Action column print ''; @@ -631,7 +644,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['d.ref']['checked'])) { print "\n"; } // Firstname diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 0705a035ba0..e5abe964d7f 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -40,6 +40,8 @@ $search_account=GETPOST('search_account','int'); $search_amount=GETPOST('search_amount','alpha'); $optioncss = GETPOST('optioncss','alpha'); +$date_select=isset($_GET["date_select"])?$_GET["date_select"]:$_POST["date_select"]; + $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -51,7 +53,19 @@ $pagenext = $page + 1; if (! $sortorder) { $sortorder="DESC"; } if (! $sortfield) { $sortfield="c.dateadh"; } -$date_select=isset($_GET["date_select"])?$_GET["date_select"]:$_POST["date_select"]; +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('subscriptionlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('subscription'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( +); +$arrayfields=array( +); // Security check $result=restrictedArea($user,'adherent','','','cotisation'); @@ -61,16 +75,32 @@ $result=restrictedArea($user,'adherent','','','cotisation'); * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; } + +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - $search=""; - $search_ref=""; - $search_lastname=""; - $search_firstname=""; - $search_login=""; - $search_note=""; - $search_amount=""; - $search_account=""; + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + { + $search=""; + $search_ref=""; + $search_lastname=""; + $search_firstname=""; + $search_login=""; + $search_note=""; + $search_amount=""; + $search_account=""; + $toselect=''; + $search_array_options=array(); + } } @@ -84,7 +114,7 @@ llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Modu // List of subscriptions -$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe,"; +$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo,"; $sql.= " c.rowid as crowid, c.subscription,"; $sql.= " c.dateadh,"; $sql.= " c.datef,"; @@ -123,7 +153,10 @@ $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - $i = 0; + + $arrayofselected=is_array($toselect)?$toselect:array(); + + $i = 0; $title=$langs->trans("ListOfSubscriptions"); if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')'; @@ -139,6 +172,16 @@ if ($result) if ($search_amount) $param.="&search_amount=".$search_amount; if ($optioncss != '') $param.='&optioncss='.$optioncss; + // List of mass actions available + $arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); + if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + //if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + print ''; if ($optioncss != '') print ''; print ''; @@ -146,8 +189,9 @@ if ($result) print ''; print ''; print ''; + print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); if ($sall) { @@ -156,23 +200,27 @@ if ($result) $moreforfilter = ''; + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + print '
'; print '
'; -$searchpitco=$form->showFilterAndCheckAddButtons(0); +$searchpitco=$form->showFilterButtons(); print $searchpitco; print '"; - print $memberstatic->getNomUrl(-1); + print $memberstatic->getNomUrl(-1, 0, 'card', 'ref'); print "
'."\n"; // Line for filters fields - print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; if (! empty($conf->banque->enabled)) { @@ -186,12 +234,12 @@ if ($result) print ''; print ''; // Action column print ''; @@ -210,7 +258,8 @@ if ($result) print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + //print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -219,48 +268,49 @@ if ($result) $adherent=new Adherent($db); $accountstatic=new Account($db); - $var=true; $total=0; while ($i < min($num, $limit)) { - $objp = $db->fetch_object($result); - $total+=$objp->subscription; + $obj = $db->fetch_object($result); + $total+=$obj->subscription; - $subscription->ref=$objp->crowid; - $subscription->id=$objp->crowid; + $subscription->ref=$obj->crowid; + $subscription->id=$obj->crowid; - $adherent->lastname=$objp->lastname; - $adherent->firstname=$objp->firstname; - $adherent->ref=$adherent->getFullName($langs); - $adherent->id=$objp->rowid; - $adherent->login=$objp->login; + $adherent->lastname=$obj->lastname; + $adherent->firstname=$obj->firstname; + $adherent->ref=$obj->rowid; + $adherent->id=$obj->rowid; + $adherent->statut=$obj->statut; + $adherent->login=$obj->login; + $adherent->photo=$obj->photo; $var=!$var; - print ""; + print ''; // Ref print ''; // Lastname - print ''; + print ''; // Login print ''; // Libelle print ''; // Banque if (! empty($conf->banque->enabled)) { - if ($objp->fk_account) + if ($obj->fk_account) { - $accountstatic->id=$objp->fk_account; - $accountstatic->fetch($objp->fk_account); - //$accountstatic->label=$objp->label; + $accountstatic->id=$obj->fk_account; + $accountstatic->fetch($obj->fk_account); + //$accountstatic->label=$obj->label; print ''; } else @@ -271,13 +321,13 @@ if ($result) } // Date start - print '\n"; + print '\n"; // Date end - print '\n"; + print '\n"; // Price - print ''; + print ''; print '';
'; - print ''; - print ''; - print ''; - print ' '; - print ''; + print ''; print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); + $searchpitco=$form->showFilterButtons(); print $searchpitco; print '
'.$subscription->getNomUrl(1).''.$adherent->getNomUrl(1).''.$adherent->getNomUrl(-1).''.$adherent->login.''; - print dol_trunc($objp->note,32); + print dol_trunc($obj->note,32); print ''.$accountstatic->getNomUrl(1).''.dol_print_date($db->jdate($objp->dateadh),'day')."'.dol_print_date($db->jdate($obj->dateadh),'day')."'.dol_print_date($db->jdate($objp->datef),'day')."'.dol_print_date($db->jdate($obj->datef),'day')."'.price($objp->subscription).''.price($obj->subscription).'