From 6c536d43e547915094097e4f3c78e31ed94fe7c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Mar 2014 11:37:32 +0100 Subject: [PATCH] Can also sort on username. Uniformize code of index page. --- htdocs/langs/en_US/opensurvey.lang | 1 + htdocs/langs/fr_FR/opensurvey.lang | 1 + htdocs/opensurvey/index.php | 33 ++++++++++++++++++++++++++++-- htdocs/opensurvey/list.php | 9 +++++--- htdocs/product/index.php | 22 ++++++++------------ 5 files changed, 48 insertions(+), 18 deletions(-) diff --git a/htdocs/langs/en_US/opensurvey.lang b/htdocs/langs/en_US/opensurvey.lang index 2a6f20ac014..48fbdc388b3 100644 --- a/htdocs/langs/en_US/opensurvey.lang +++ b/htdocs/langs/en_US/opensurvey.lang @@ -35,6 +35,7 @@ AddNewColumn=Add new column TitleChoice=Choice label ExportSpreadsheet=Export result spreadsheet ExpireDate=Limit date +NbOfSurveys=Number of surveys NbOfVoters=Nb of voters SurveyResults=Results PollAdminDesc=You are allowed to change all vote lines of this poll with button "Edit". You can, as well, remove a column or a line with %s. You can also add a new column with %s. diff --git a/htdocs/langs/fr_FR/opensurvey.lang b/htdocs/langs/fr_FR/opensurvey.lang index 5fc7ff81249..e98f26c4f33 100644 --- a/htdocs/langs/fr_FR/opensurvey.lang +++ b/htdocs/langs/fr_FR/opensurvey.lang @@ -35,6 +35,7 @@ AddNewColumn=Ajouter nouvelle colonne TitleChoice=Libellé du choix ExportSpreadsheet=Exporter feuille de résultats ExpireDate=Date expiration +NbOfSurveys=Nombre de sondage NbOfVoters=Nombre de votants SurveyResults=Résultats PollAdminDesc=Vous êtes habilité à modifier toutes les lignes de votes par le bouton "Éditer". Vous pouvez supprimer une colonne ou ligne avec %s. Vous pouvez aussi ajouter une nouvelle colonne avec %s. diff --git a/htdocs/opensurvey/index.php b/htdocs/opensurvey/index.php index 0f809f8e52f..a69b1ff19bd 100644 --- a/htdocs/opensurvey/index.php +++ b/htdocs/opensurvey/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2013-2014 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 @@ -46,9 +46,38 @@ if ($resql) } else dol_print_error($db,''); + + print_fiche_titre($langs->trans("OpenSurveyArea")); -echo $langs->trans("NoSurveysInDatabase",$nbsondages).'

'."\n"; + +print '
'; + + +$nbsondages=0; +$sql='SELECT COUNT(*) as nb FROM '.MAIN_DB_PREFIX.'opensurvey_sondage'; +$resql=$db->query($sql); +if ($resql) +{ + $obj=$db->fetch_object($resql); + $nbsondages=$obj->nb; +} +else dol_print_error($db,''); + +print ''; +print ''; +print ""; +print ''; +print ""; +//print ''; +print '
'.$langs->trans("OpenSurveyArea").'
'.$langs->trans("NbOfSurveys").''.$nbsondages.'
'.$langs->trans("Total").''; +//print $total; +//print '
'; + + +print '
'; + + llxFooter(); diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 76a3b959d2b..4b0ca196639 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -75,6 +75,7 @@ $now = dol_now(); llxHeader(); $param=''; +$fieldtosortuser=empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?'firstname':'lastname'; print '
'."\n"; @@ -93,7 +94,7 @@ print ''; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.id_sondage",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Title"), $_SERVER["PHP_SELF"], "p.titre",$param,"","",$sortfield,$sortorder); print ''. $langs->trans("Type") .''; -print ''. $langs->trans("Author") .''; +print_liste_field_titre($langs->trans("Author"), $_SERVER["PHP_SELF"], "u.".$fieldtosortuser,$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ExpireDate"), $_SERVER["PHP_SELF"], "p.date_fin",$param,"",'align="center"',$sortfield,$sortorder); print ''. $langs->trans("NbOfVoters") .''; print ''."\n"; @@ -112,7 +113,7 @@ print ''; print ''."\n"; $sql = "SELECT p.id_sondage, p.fk_user_creat, p.format, p.date_fin, p.titre, p.nom_admin,"; -$sql.= " u.login"; +$sql.= " u.login, u.firstname, u.lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p"; $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = p.fk_user_creat"; // Count total nb of records @@ -162,7 +163,9 @@ while ($i < min($num,$limit)) if ($obj->fk_user_creat) { $userstatic = new User($db); $userstatic->id = $obj->fk_user_creat; - $userstatic->login = $obj->login; + $userstatic->firstname = $obj->firstname; + $userstatic->lastname = $obj->lastname; + $userstatic->login = $userstatic->getFullName($langs, 0, -1, 48); print $userstatic->getLoginUrl(1); } else { diff --git a/htdocs/product/index.php b/htdocs/product/index.php index daa2ae08854..a9c73f822eb 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -68,8 +68,6 @@ llxHeader("",$langs->trans("ProductsAndServices"),$helpurl); print_fiche_titre($transAreaType); -//print ''; -//print '
'; print '
'; @@ -122,19 +120,19 @@ print ''; print ''; if (! empty($conf->product->enabled)) { - $statProducts = ""; + $statProducts = ""; $statProducts.= ''; $statProducts.= ""; - $statProducts.= ""; + $statProducts.= ""; $statProducts.= ''; $statProducts.= ""; } if (! empty($conf->service->enabled)) { - $statServices = ""; + $statServices = ""; $statServices.= ''; $statServices.= ""; - $statServices.= ""; + $statServices.= ""; $statServices.= ''; $statServices.= ""; } @@ -160,7 +158,6 @@ print ''; print '
'.$langs->trans("Statistics").'
'.$langs->trans("ProductsNotOnSell").''.round($prodser[0][0]).'
'.$langs->trans("ProductsOnSell").''.round($prodser[0][1]).'
'.$langs->trans("ServicesNotOnSell").''.round($prodser[1][0]).'
'.$langs->trans("ServicesOnSell").''.round($prodser[1][1]).'
'; -//print '
'; print '
'; @@ -261,7 +258,7 @@ else // TODO Move this into a page that should be available into menu "accountancy - report - turnover - per quarter" -// Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover": +// Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover": // "commitment engagment" method and "cash accounting" method if ($conf->global->MAIN_FEATURES_LEVEL) { @@ -270,7 +267,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL) } -//print '
'; print '
'; llxFooter(); @@ -283,8 +279,8 @@ $db->close(); function activitytrim($product_type) { global $conf,$langs,$db; - - // on affiche les 3 dernières années + + // on affiche les 3 dernières années $yearofbegindate=date('Y',dol_time_plus_duree(time(), -3, "y")); // ventilation par trimestre @@ -311,7 +307,7 @@ function activitytrim($product_type) $trim4=0; $lgn = 0; $num = $db->num_rows($result); - + if ($num > 0 ) { print '
'; @@ -353,7 +349,7 @@ function activitytrim($product_type) $trim3=0; $trim4=0; } - + if ($objp->mois == "01" || $objp->mois == "02" || $objp->mois == "03") $trim1 += $objp->Mnttot;