diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 5c06109219b8a93dcffd5779938520a39f425cc2..16608a5fae22a50dd0e447562c79e5a00667b94e 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -169,8 +169,9 @@ if (! empty($triggers)) //print 'module='.$module.'<br>'; if (! empty($conf->$module->enabled)) { - // Discard special case. + // Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue; + if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue; $var=!$var; print '<tr '.$bc[$var].'>'; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index e5472727aa244ffae7f35d29ab24f34f6d14a922..c414d3409d68fb2573ab4d47b85aded7fea70527 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -341,11 +341,14 @@ dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup); dol_fiche_end(); + +// Define the legend/list of calendard to show +$s=''; $link=''; + $showextcals=$listofextcals; -// Legend -if (! empty($conf->use_javascript_ajax)) + +if (! empty($conf->use_javascript_ajax)) // If javascript on { - $s=''; $s.='<script type="text/javascript">' . "\n"; $s.='jQuery(document).ready(function () {' . "\n"; $s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n"; @@ -358,7 +361,10 @@ if (! empty($conf->use_javascript_ajax)) $s.='});' . "\n"; $s.='</script>' . "\n"; + // Local calendar $s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' </div>'; + + // External calendars if (is_array($showextcals) && count($showextcals) > 0) { $s.='<script type="text/javascript">' . "\n"; @@ -377,13 +383,23 @@ if (! empty($conf->use_javascript_ajax)) $s.='<div class="nowrap float"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked> ' . $val['name'] . ' </div>'; } } - $s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>'; -} + // Birthdays + $s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>'; -$link=''; -// Add link to show birthdays -if (empty($conf->use_javascript_ajax)) + // Calendars from hooks + $parameters=array(); $object=null; + $reshook=$hookmanager->executeHooks('addCalendarChoice',$parameters,$object,$action); + if (empty($reshook)) + { + $s.= $hookmanager->resPrint; + } + elseif ($reshook > 1) + { + $s = $hookmanager->resPrint; + } +} +else // If javascript off { $newparam=$param; // newparam is for birthday links $newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam); @@ -396,10 +412,10 @@ if (empty($conf->use_javascript_ajax)) $link.='</a>'; } -print_fiche_titre($s,$link.' '.$nav, ''); +print_fiche_titre($s, $link.' '.$nav, ''); -// Get event in an array +// Load events from database into $eventarray $eventarray=array(); $sql = 'SELECT '; @@ -470,6 +486,7 @@ if ($filtert > 0 || $usergroup > 0) $sql.= ' ORDER BY datep'; //print $sql; + dol_syslog("comm/action/index.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) @@ -571,6 +588,7 @@ else dol_print_error($db); } +// Complete $eventarray with birthdates if ($showbirthday) { // Add events in array @@ -638,6 +656,7 @@ if ($showbirthday) } } +// Complete $eventarray with external import Ical if (count($listofextcals)) { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/ical.class.php'; @@ -878,6 +897,15 @@ if (count($listofextcals)) } } + + +// Complete $eventarray with events coming from external module +$parameters=array(); $object=null; +$reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action); +if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($eventarray, $hookmanager->resArray['eventarray']); + + + $maxnbofchar=18; $cachethirdparties=array(); $cachecontacts=array(); diff --git a/htdocs/comm/askpricesupplier/list.php b/htdocs/comm/askpricesupplier/list.php index bce521489e0407c4819db9f33297855f5f0974b3..2e78045b3085cf840d44f9975ae86e16b17eb06e 100644 --- a/htdocs/comm/askpricesupplier/list.php +++ b/htdocs/comm/askpricesupplier/list.php @@ -270,22 +270,22 @@ if ($result) print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AskPriceSupplierDate'),$_SERVER["PHP_SELF"],'p.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; print '<tr class="liste_titre">'; print '<td class="liste_titre">'; print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">'; - print '</td>'; + print '</td>'; print '<td class="liste_titre" align="left">'; print '<input class="flat" type="text" size="12" name="search_societe" value="'.$search_societe.'">'; print '</td>'; - + // Date print '<td class="liste_titre" colspan="1" align="center">'; //print $langs->trans('Month').': '; @@ -294,7 +294,7 @@ if ($result) $syear = $year; $formother->select_year($syear,'year',1, 20, 5); print '</td>'; - + // Amount print '<td class="liste_titre" align="right">'; print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">'; @@ -353,7 +353,7 @@ if ($result) print '</td></tr></table>'; print "</td>\n"; - + $url = DOL_URL_ROOT.'/comm/card.php?socid='.$objp->rowid; // Company @@ -364,12 +364,12 @@ if ($result) print '<td>'; print $companystatic->getNomUrl(1,'customer'); print '</td>'; - + // Date askprice print '<td align="center">'; print dol_print_date($db->jdate($objp->dp), 'day'); print "</td>\n"; - + print '<td align="right">'.price($objp->total_ht)."</td>\n"; $userstatic->id=$objp->fk_user_author; diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index 43c2f4155fc7c03152dc5442c60927f0e3e2b479..126ffc5f4701a87de52782e1ae94910cbd0a6b9f 100644 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -205,7 +205,7 @@ if ($result) $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_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; print '<tr class="liste_titre">'; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 6958821a05f586df37b9f20e29a2976660fcf918..5e2aa787dba555b9fb331c044e3da28006d50c83 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -420,7 +420,7 @@ if ($object->fetch($id) >= 0) } print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print '</tr>'; @@ -459,7 +459,7 @@ if ($object->fetch($id) >= 0) print '<td class="liste_titre" align="right">'; print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print ' '; - print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; + print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Reset"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '</td>'; print '</tr>'; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index c8e96919f8431dfc1e93aaea57ea5ccced5d8ccb..36484d718c71d74b4a1e858e598e70b4709dc484 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -9,8 +9,8 @@ * Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> - * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> -* + * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -255,6 +255,7 @@ if ($result) if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht; if ($search_author) $param.='&search_author='.$search_author; if ($search_town) $param.='&search_town='.$search_town; + print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png'); // Lignes des champs de filtre @@ -310,7 +311,7 @@ if ($result) print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; print '<tr class="liste_titre">'; diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 5f841b609da1b2fb381df1567b26ab64cc499a10..70847f479c367f017b9b6b3bf738677cd9056664 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -351,9 +351,8 @@ if ($resql) $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_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; print '<tr class="liste_titre">'; @@ -416,7 +415,7 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print '<td class="liste_titre" align="center">'; + print '<td class="liste_titre" align="right">'; print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print '</td>'; @@ -474,8 +473,8 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print '<td align="center">'; - print $prospectstatic->LibStatut($prospectstatic->status,3); + print '<td align="right">'; + print $prospectstatic->LibStatut($prospectstatic->status,5); print '</td>'; print '<td></td>'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 351a4171dd6f99b135099b9a325f049427f8b68a..1b3f8432b5218f0093d42be6e577892cd478a69a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -130,13 +130,8 @@ $sql.= ' WHERE c.fk_soc = s.rowid'; $sql.= ' AND c.entity IN ('.getEntity('commande', 1).')'; if ($socid) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($search_ref) { - $sql .= natural_search('c.ref', $search_ref); -} -if ($sall) -{ - $sql .= natural_search(array('c.ref', 'c.note_private'), $sall); -} +if ($search_ref) $sql .= natural_search('c.ref', $search_ref); +if ($sall) $sql .= natural_search(array('c.ref', 'c.note_private'), $sall); if ($viewstatut <> '') { if ($viewstatut < 4 && $viewstatut > -3) @@ -190,24 +185,12 @@ else if ($deliveryyear > 0) { $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,12,false))."'"; } -if (!empty($search_company)) -{ - $sql .= natural_search('s.nom', $search_company); -} -if (!empty($search_ref_customer)) -{ - $sql.= ' AND c.ref_client LIKE \'%'.$db->escape($search_ref_customer).'%\''; -} +if (!empty($search_company)) $sql .= natural_search('s.nom', $search_company); +if (!empty($search_ref_customer)) $sql.= natural_search('c.ref_client', $search_ref_customer); if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; -if ($search_user > 0) -{ - $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; -} -if ($search_total_ht != '') -{ - $sql.= natural_search('c.total_ht', $search_total_ht, 1); -} -$sql.= ' ORDER BY '.$sortfield.' '.$sortorder; +if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; +if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); +$sql.= $db->order($sortfield,$sortorder); $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -216,7 +199,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $nbtotalofrecords = $db->num_rows($result); } - $sql.= $db->plimit($limit + 1,$offset); //print $sql; @@ -291,7 +273,7 @@ if ($resql) if (! empty($moreforfilter)) { print '<tr class="liste_titre">'; - print '<td class="liste_titre" colspan="9">'; + print '<td class="liste_titre" colspan="10">'; print $moreforfilter; print '</td></tr>'; } @@ -304,6 +286,7 @@ if ($resql) print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print '</tr>'; print '<tr class="liste_titre">'; @@ -328,6 +311,7 @@ if ($resql) print '<td class="liste_titre" align="right">'; print '<input class="flat" type="text" size="6" name="search_total_ht" value="'.$search_total_ht.'">'; print '</td>'; + print '<td></td>'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print "</td></tr>\n"; @@ -493,6 +477,8 @@ if ($resql) // Statut print '<td align="right" class="nowrap">'.$generic_commande->LibStatut($objp->fk_statut,$objp->facturee,5).'</td>'; + print '<td></td>'; + print '</tr>'; $total+=$objp->total_ht; @@ -507,7 +493,8 @@ if ($resql) print '<td class="nowrap" colspan="5">'.$langs->trans('TotalHT').'</td>'; // Total HT print '<td align="right" class="nowrap">'.price($total).'</td>'; - print '<td class="nowrap"> </td>'; + print '<td></td>'; + print '<td></td>'; print '</tr>'; } diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index bcb7d44559ce96ff4a438c21c26cf5a97de24cb8..aab2e0b18d5e17085fba8c666dce040393bf8e90 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> @@ -129,7 +129,7 @@ if ($action == 'create') print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="facid" value="'.$object->id.'">'; - + dol_fiche_head(); $rowspan=4; @@ -202,7 +202,7 @@ if ($action == 'create') $sql = 'SELECT l.fk_product, l.product_type, l.label as custom_label, l.description, l.qty, l.rowid, l.tva_tx,'; $sql.= ' l.fk_remise_except,'; $sql.= ' l.remise_percent, l.subprice, l.info_bits,'; - $sql.= ' l.total_ht, l.total_tva, l.total_ttc,'; + $sql.= ' l.total_ht, l.total_tva as total_vat, l.total_ttc,'; $sql.= ' l.date_start,'; $sql.= ' l.date_end,'; $sql.= ' l.product_type,'; @@ -220,7 +220,7 @@ if ($action == 'create') $num = $db->num_rows($result); $i = 0; $total = 0; - echo '<table class="notopnoleftnoright" width="100%">'; + echo '<table class="noborder" width="100%">'; if ($num) { print '<tr class="liste_titre">'; @@ -572,7 +572,7 @@ else /* * List mode */ - $sql = "SELECT s.nom as name, s.rowid as socid, f.titre, f.total, f.rowid as facid"; + $sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity = ".$conf->entity; @@ -594,8 +594,10 @@ else print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans("Ref")); print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"s.nom","","&socid=$socid","",$sortfiled,$sortorder); - print_liste_field_titre($langs->trans("Amount"),'','','','','align="right"'); - print_liste_field_titre(''); + print_liste_field_titre($langs->trans("AmountHT"),'','','','','align="right"'); + print_liste_field_titre($langs->trans("AmountVAT"),'','','','','align="right"'); + print_liste_field_titre($langs->trans("AmountTTC"),'','','','','align="right"'); + print_liste_field_titre(''); // Field may contains ling text print "</tr>\n"; if ($num > 0) @@ -616,19 +618,21 @@ else print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>'; print '<td align="right">'.price($objp->total).'</td>'."\n"; + print '<td align="right">'.price($objp->total_vat).'</td>'."\n"; + print '<td align="right">'.price($objp->total_ttc).'</td>'."\n"; - echo '<td align="center">'; - + print '<td align="center">'; if ($user->rights->facture->creer) { - echo '<a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$objp->socid.'&fac_rec='.$objp->facid.'">'; - echo $langs->trans("CreateBill"),'</a>'; + print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$objp->socid.'&fac_rec='.$objp->facid.'">'; + print $langs->trans("CreateBill").'</a>'; } else { - echo " "; + print " "; } - echo "</td></tr>\n"; + print "</td>"; + print "</tr>\n"; $i++; } } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 18f5fe4db34d79475697e04d0f2210c2ad10d169..a38049ae10fc9b0921fad76b70a01518b1749d43 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -180,30 +180,12 @@ if ($filtre) $sql .= ' AND ' . trim($filt[0]) . ' = ' . trim($filt[1]); } } -if ($search_ref) -{ - $sql .= natural_search('f.facnumber', $search_ref); -} -if ($search_refcustomer) -{ - $sql .= natural_search('f.ref_client', $search_refcustomer); -} -if ($search_societe) -{ - $sql .= natural_search('s.nom', $search_societe); -} -if ($search_montant_ht != '') -{ - $sql.= natural_search('f.total', $search_montant_ht, 1); -} -if ($search_montant_ttc != '') -{ - $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); -} -if ($search_status != '') -{ - $sql.= " AND f.fk_statut = '".$db->escape($search_status)."'"; -} +if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref); +if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); +if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); +if ($search_status != '') $sql.= " AND f.fk_statut = '".$db->escape($search_status)."'"; if ($month > 0) { if ($year > 0 && empty($day)) @@ -258,7 +240,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $nbtotalofrecords = $db->num_rows($result); } - $sql.= $db->plimit($limit+1,$offset); //print $sql; @@ -307,7 +288,7 @@ if ($resql) if ($moreforfilter) { print '<tr class="liste_titre">'; - print '<td class="liste_titre" colspan="10">'; + print '<td class="liste_titre" colspan="11">'; print $moreforfilter; print '</td></tr>'; } @@ -323,6 +304,7 @@ if ($resql) print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Received'),$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut,paye,am','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; // Filters lines @@ -345,9 +327,10 @@ if ($resql) print '</td>'; print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>'; print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'"></td>'; - print '<td class="liste_titre" align="right"> </td>'; + print '<td class="liste_titre"></td>'; print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>'; - print '<td class="liste_titre" align="right"> </td>'; + print '<td class="liste_titre"></td>'; + print '<td class="liste_titre"></td>'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print "</td></tr>\n"; @@ -439,7 +422,9 @@ if ($resql) print '<td align="right" class="nowrap">'; print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$paiement,$objp->type); print "</td>"; - //print "<td> </td>"; + + print "<td></td>"; + print "</tr>\n"; $total_ht+=$objp->total_ht; $total_tva+=$objp->total_tva; @@ -457,7 +442,8 @@ if ($resql) print '<td class="liste_total" align="right">'.price($total_tva,0,$langs).'</td>'; print '<td class="liste_total" align="right">'.price($total_ttc,0,$langs).'</td>'; print '<td class="liste_total" align="right">'.price($totalrecu,0,$langs).'</td>'; - print '<td class="liste_total" align="center"> </td>'; + print '<td class="liste_total"></td>'; + print '<td class="liste_total"></td>'; print '</tr>'; } } diff --git a/htdocs/compta/facture/mergepdftool.php b/htdocs/compta/facture/mergepdftool.php index e8010229a8e364ac218b809e91857c22ed104439..d29f237c331d728fa2db4621346df8ae75f26ffb 100644 --- a/htdocs/compta/facture/mergepdftool.php +++ b/htdocs/compta/facture/mergepdftool.php @@ -654,13 +654,16 @@ if ($resql) print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder); + + $searchpitco='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; + $searchpitco.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Reset"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; if (empty($mode)) { - print_liste_field_titre($langs->trans("PDFMerge"),$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($searchpitco,$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder); } else { - print_liste_field_titre($langs->trans("Remind"),$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($searchpitco,$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder); } print "</tr>\n"; @@ -695,9 +698,6 @@ if ($resql) print $form->selectarray('filtre', $liststatus, $filter, 1); print '</td>'; print '<td class="liste_titre" align="center">'; - print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; - print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; - print '<br>'; if (empty($mode)) { if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>'; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index fe32541a0fc7c308bcc69d1e9b6e6617f7d4d6cc..aaebcf697f33b1065aa0d047196da36488fee4a8 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -705,7 +705,7 @@ if (! GETPOST('action')) print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; while ($i < min($num,$limit)) @@ -728,6 +728,6 @@ if (! GETPOST('action')) } } -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index f2b6bcf1490fbfeabf741b3682bc29b9ec65a47c..d284a12863137ce49219050ea659cf8b7198f2ce 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -68,6 +68,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_company=""; } +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('paymentlist')); +$extrafields = new ExtraFields($db); + + + /* * View */ @@ -81,24 +87,37 @@ if (GETPOST("orphelins")) // Paiements lies a aucune facture (pour aide au diagnostic) $sql = "SELECT p.rowid, p.datep as dp, p.amount,"; $sql.= " p.statut, p.num_paiement,"; - //$sql.= " c.libelle as paiement_type"; $sql.= " c.code as paiement_code"; + // 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."paiement as p,"; $sql.= " ".MAIN_DB_PREFIX."c_paiement as c)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; $sql.= " WHERE p.fk_paiement = c.id"; $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND pf.fk_facture IS NULL"; + // 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; } else { $sql = "SELECT DISTINCT p.rowid, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives $sql.= " p.statut, p.num_paiement,"; - //$sql.= " c.libelle as paiement_type,"; $sql.= " c.code as paiement_code,"; $sql.= " ba.rowid as bid, ba.label,"; $sql.= " s.rowid as socid, s.nom as name"; - //$sql.= " f.facnumber"; + // 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_paiement as c, ".MAIN_DB_PREFIX."paiement as p)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; @@ -127,6 +146,10 @@ else if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'"; if ($search_amount) $sql .=" AND p.amount='".$db->escape(price2num($search_amount))."'"; if ($search_company) $sql .= natural_search('s.nom', $search_company); + // 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($limit+1, $offset); @@ -157,11 +180,13 @@ if ($resql) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$paramlist,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$paramlist,'align="right"',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("Invoices"),"","","",$paramlist,'align="left"',$sortfield,$sortorder); - if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) - { - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$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; + + if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; // Lines for filters fields @@ -199,7 +224,7 @@ if ($resql) $var=!$var; print "<tr ".$bc[$var].">"; - print '<td width="40">'; + print '<td>'; $paymentstatic->id=$objp->rowid; $paymentstatic->ref=$objp->rowid; print $paymentstatic->getNomUrl(1); diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 11c9dd3a9abfec6562285a068279ea35e0474f62..0e08b70f87ea65fd79040eaa48df3d671f2a7ac9 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -134,7 +134,7 @@ if ($result) print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; print '<tr class="liste_titre">'; diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 31e98370003fd057905daaf096274339f94ae751..3afbba0df791dfe4eaa3da55ab09cd203100dea1 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -164,6 +164,7 @@ if ($resql) print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cs.paye","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; print '<tr class="liste_titre">'; @@ -184,6 +185,8 @@ if ($resql) print '<input class="flat" type="text" size="6" name="search_amount" value="'.$search_amount.'">'; print '</td>'; print '<td class="liste_titre"> </td>'; + // Status + print '<td class="liste_titre"> </td>'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print "</td></tr>\n"; @@ -228,6 +231,8 @@ if ($resql) print '<td align="right" class="nowrap">'.$chargesociale_static->LibStatut($obj->paye,5,$obj->alreadypayed).'</a></td>'; + print '<td></td>'; + print '</tr>'; $i++; } diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index de18f2af661ac393cdcc244f830b91e3b7482153..3f9c0d1bb5989270e255304f52a78765f3bef831 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * @@ -140,7 +140,7 @@ if ($result) print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dm","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; print '<tr class="liste_titre">'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index a564bafc4a94f6a646878d44566b8d9726dcbc03..c6ac982e348724c8928f5ee4a3a33b479bc5f03c 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -311,7 +311,7 @@ if ($result) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms", $begin, $param, 'align="center"', $sortfield,$sortorder); print_liste_field_titre($langs->trans("ContactVisibility"),$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut", $begin, $param, 'align="center"', $sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; // Lines for filter fields diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index b26f8c3c3d394c2f668a25a7e77dcb3a226a8f13..d1c5547cccc8e5d56946ee8fa53dbf64a908c372 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -116,8 +116,8 @@ class HookManager * @param array $parameters Array of parameters * @param Object $object Object to use hooks on * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) - * @return mixed For 'addreplace hooks (doActions,formObjectOptions,pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 if KO. - * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. + * @return mixed For 'addreplace hooks (doActions,formObjectOptions,pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results and set into ->resArray. + * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results and set into ->resArray. * All types can also return some values into an array ->results. * $this->error or this->errors are also defined by class called by this function if error. */ @@ -128,7 +128,7 @@ class HookManager $parameters['context']=join(':',$this->contextarray); dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']); - // Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated). + // Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated because a 'addreplace' hook can also return resPrint and resArray). $hooktype='output'; if (in_array( $method, @@ -146,7 +146,8 @@ class HookManager 'paymentsupplierinvoices', 'printAddress', 'printSearchForm', - 'formatEvent' + 'formatEvent', + 'addCalendarChoice' ) )) $hooktype='addreplace'; // Deprecated hook types ('returnvalue') diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 7f0e27ac27dcd074e16a53cdeb77f197891f4f90..74a2440ca1cb94dc97c7a5ab33a9100b0062b769 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -876,7 +876,7 @@ class FormOther $min_year = $currentyear-$min_year; if(empty($selected) && empty($useempty)) $selected = $currentyear; - $out.= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >'; + $out.= '<select class="flat" placeholder="aa" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >'; if($useempty) { $selected_html=''; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e6b0f0a8dd6483959d1c28db0ea96179a973d31b..5ba2ea89009fbc1046678cbee3b88588f44ec410 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -971,6 +971,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) $out.="<tr ".$bc[$var].">"; + // Date $out.='<td width="120" align="left" class="nowrap">'; $out.=dol_print_date($datep,'dayhour'); if ($datep2 && $datep2 != $datep) @@ -998,7 +999,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) // Title of event //$out.='<td colspan="2">'.dol_trunc($obj->label,40).'</td>'; - $out.='<td colspan="2">'.$actionstatic->getNomUrl(1,40).'</td>'; + $out.='<td colspan="2">'.$actionstatic->getNomUrl(1,120).'</td>'; // Contact pour cette action if (empty($objcon->id) && $obj->fk_contact > 0) @@ -1240,14 +1241,14 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) //$actionstatic->libelle=$libelle; $actionstatic->libelle=$histo[$key]['note']; $actionstatic->id=$histo[$key]['id']; - $out.=$actionstatic->getNomUrl(1,40); + $out.=$actionstatic->getNomUrl(1,120); } if (isset($histo[$key]['type']) && $histo[$key]['type']=='mailing') { $out.='<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"),"email").' '; $transcode=$langs->trans("Action".$histo[$key]['acode']); $libelle=($transcode!="Action".$histo[$key]['acode']?$transcode:'Send mass mailing'); - $out.=dol_trunc($libelle,40); + $out.=dol_trunc($libelle,120); } $out.='</td>'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ff3c968a1d6782c06d3f29565d5fcd000e911f97..0e86a1b6163aff3522bf3cb9916a82b86abdc1aa 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2639,7 +2639,7 @@ function dol_print_error_email($prefixcode) * @param string $td Options of attribute td ("" by defaut, example: 'align="center"') * @param string $sortfield Current field used to sort * @param string $sortorder Current sort order - * @param string $prefix Prefix for css + * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag. * @return void */ function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $td="", $sortfield="", $sortorder="", $prefix="") @@ -2659,7 +2659,7 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar * @param string $moreattrib Add more attributes on th ("" by defaut) * @param string $sortfield Current field used to sort * @param string $sortorder Current sort order - * @param string $prefix Prefix for css + * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag. * @return string */ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="") @@ -2675,7 +2675,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m // If field is used as sort criteria we use a specific class // Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom") - if ($field && ($sortfield == $field || $sortfield == preg_replace("/^[^\.]+\./","",$field))) $out.= '<'.$tag.' class="liste_titre_sel" '. $moreattrib.'>'; + if ($field && ($sortfield == $field || $sortfield == preg_replace("/^[^\.]+\./","",$field))) $out.= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '. $moreattrib.'>'; else $out.= '<'.$tag.' class="'.$prefix.'liste_titre" '. $moreattrib.'>'; if (! empty($conf->dol_optimize_smallscreen) && empty($thead) && $field) // If this is a sort field diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b2e1992f0f92e0d39bf3da3918ea418fba940afc..7f2640fad4a48f8c0f5031fd3c8489eeed3f4bc2 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1194,6 +1194,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire && $user->rights->projet->lire, '', $mainmenu, 'projects'); $newmenu->add("/projet/card.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer && $user->rights->projet->creer); $newmenu->add("/projet/list.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire); + $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire && $user->rights->projet->lire); if (empty($conf->global->PROJECT_HIDE_TASKS)) { diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 45f59975ee0f32d14b0d769b428f248c6dea4b8c..aa629955f53accee8c29c4b88328ef46f66de635 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -133,7 +133,7 @@ if ($resql) print_liste_field_titre($langs->trans("DateReceived"), $_SERVER["PHP_SELF"],"l.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); } print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; // Lignes des champs de filtre @@ -158,7 +158,8 @@ if ($resql) // Status print '<td></td>'; // Search - print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; + print '<td class="liste_titre" align="right">'; + print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '</td>'; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index c0b30b6c87330b6f4ee1131065e7ec2233df2cd4..ef7b8d5311aa90506c75000649cd24be99f7543e 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -191,7 +191,7 @@ if ($resql) print_liste_field_titre($langs->trans("TotalVAT"),$_SERVER["PHP_SELF"],"d.total_tva","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("TotalTTC"),$_SERVER["PHP_SELF"],"d.total_ttc","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Statut"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; // Filters @@ -263,10 +263,13 @@ if ($resql) print '<td align="right">'.price($objp->total_ttc).'</td>'; $expensereporttmp->status=$objp->status; - print '<td align="right" colspan="2">'; + print '<td align="right">'; //print $objp->status; print $expensereporttmp->getLibStatut(5); print '</td>'; + + print '<td></td>'; + print "</tr>\n"; $total_total_ht = $total_total_ht + $objp->total_ht; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 367af084cdeb704d577700a7061b24bd85f8a60b..0e9a5a8c4e0196df79fb01da5129915dfeb66c3c 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -145,7 +145,7 @@ if ($result) print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder); } print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; print '<tr class="liste_titre">'; @@ -224,6 +224,7 @@ else dol_print_error($db); } -$db->close(); llxFooter(); + +$db->close(); \ No newline at end of file diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index d73fa983e1cd7f1ed977fea4da863e2dccbf2eed..c21830e66e8be9028308d7aaf206c6922eaa8850 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> @@ -200,7 +200,7 @@ if ($resql) print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"dc","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('DateDeliveryPlanned'),$_SERVER["PHP_SELF"],'cf.date_livraison','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cf.fk_statut","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; print '<tr class="liste_titre">'; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 5fe72b44328147458394e52eeccb80d3140d16d0..d93f1c4beea3c6d1230d0a12dacbc940aeb9109d 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -9,7 +9,7 @@ * Copyright (C) 2015 juanjo Menent <jmenent@2byte.es> * Copyright (C) 2015 Abbes Bahfir <bafbes@gmail.com> * Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -264,7 +264,7 @@ if ($resql) print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"fac.total_ht","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"fac.total_ttc","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; // Line for filters diff --git a/htdocs/fourn/list.php b/htdocs/fourn/list.php index 692671fba31abd44be7255a9741e5b3323613704..3333ffefba2737b4e201651cf213230aaffb309a 100644 --- a/htdocs/fourn/list.php +++ b/htdocs/fourn/list.php @@ -202,7 +202,7 @@ if ($resql) 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_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; print '<tr class="liste_titre">'; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 8e2e04019cef4f72346187339c98af65b20720b2..f5d67b13517ca9776941fd4436d17c5d02162ddd 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -276,7 +276,7 @@ print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','', print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date_debut","",'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="center"',$sortfield,$sortorder); -print_liste_field_titre(''); +print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; // FILTRES @@ -395,7 +395,8 @@ if (! empty($holiday->holiday)) print '</td>'; print '<td align="center">'.dol_print_date($infos_CP['date_debut'],'day').'</td>'; print '<td align="center">'.dol_print_date($infos_CP['date_fin'],'day').'</td>'; - print '<td align="right" colspan="2">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>'; + print '<td align="right">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>'; + print '<td></td>'; print '</tr>'."\n"; } diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 5b0b6705e5a348b64a798377ad6a954ca53c2a8b..3bd8c282c38e77158886a4cc47172a28c695f99c 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -725,3 +725,7 @@ INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES ( INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (6,'WIN' ,'Won', 60, 100,1); INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (7,'LOST' ,'Lost', 70, 0,1); + +DELETE FROM llx_c_action_trigger where code = 'PROPAL_CLASSIFYBILLED'; +DELETE FROM llx_c_action_trigger where code = 'FICHINTER_CLASSIFYBILLED'; + diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index aadd66038535a150661cf3ef1be4fd19f09194a9..de6f0fe05760e8b701428b51b007538686e11940 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -158,3 +158,5 @@ AssignTask=Assign ProjectOverview=Overview ManageTasks=Use projects to follow tasks and time ManageOpportunitiesStatus=Use projects to follow leads/opportinuties +ProjectNbProjectByMonth=Nb of created projects by month +ProjectsStatistics=Statistics on projects/leads \ No newline at end of file diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a501212c8ba3ce31c03338dd29421825274b6d15..28af434d56a4e4e2b07fd0ce21e7bf4c5aef65f7 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -808,7 +808,8 @@ class Product extends CommonObject { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref); + if (empty($conf->barcode->enabled)) $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref); + else $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductBarCodeAlreadyExists",$this->barcode); $this->db->rollback(); return -1; } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index c7e0da02de3b7a0672d84a2ebfe5e783d5dd2a3b..77e8373d2a7ae8ed4289eca93dd8414fa3914449 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -324,7 +324,7 @@ else if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("PhysicalStock").'</td>'; print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; // Lignes des champs de filtre @@ -381,11 +381,11 @@ else print '</td>'; } - print '<td align="center">'; + print '<td class="liste_titre" align="center">'; print $form->selectarray('tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$tosell,1); print '</td >'; - print '<td align="center">'; + print '<td class="liste_titre" align="center">'; print $form->selectarray('tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$tobuy,1); print '</td>'; @@ -393,6 +393,7 @@ else print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '</td>'; + print '</tr>'; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index df4c8b9d0545474c199d69713f69fec541601c98..22ed390bc8f0ebdfb66abaebd63ef8bddf7833de 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -518,6 +518,10 @@ else print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="id" value="'.$object->id.'">'; + $head = stock_prepare_head($object); + + dol_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock'); + print '<table class="border" width="100%">'; // Ref @@ -559,7 +563,9 @@ else print '</table>'; - print '<br><div class="center">'; + dol_fiche_end(); + + print '<div class="center">'; print '<input type="submit" class="button" value="'.$langs->trans("Save").'">'; print ' '; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 225a33a94831c9ff7ba874057958b35c34a8197f..2c48b4587a0ddb8c65bba38917161f62d90dac5f 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -31,9 +31,10 @@ $langs->load("stocks"); // Security check $result=restrictedArea($user,'stock'); -$sref=GETPOST("sref","alpha"); -$snom=GETPOST("snom","alpha"); +$search_ref=GETPOST("sref","alpha")?GETPOST("sref","alpha"):GETPOST("search_ref","alpha"); +$search_label=GETPOST("snom","alpha")?GETPOST("snom","alpha"):GETPOST("search_label","alpha"); $sall=GETPOST("sall","alpha"); +$search_status=GETPOST("search_status","int"); $sortfield = GETPOST("sortfield"); $sortorder = GETPOST("sortorder"); @@ -52,6 +53,7 @@ $year = strftime("%Y",time()); */ $form=new Form($db); +$warehouse=new Entrepot($db); $sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,"; $sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; @@ -59,22 +61,14 @@ $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; $sql.= " WHERE e.entity IN (".getEntity('stock', 1).")"; -if ($sref) -{ - $sql.= " AND e.label LIKE '%".$db->escape($sref)."%'"; -} -if ($sall) -{ - $sql.= " AND (e.label LIKE '%".$db->escape($sall)."%'"; - $sql.= " OR e.description LIKE '%".$db->escape($sall)."%'"; - $sql.= " OR e.lieu LIKE '%".$db->escape($sall)."%'"; - $sql.= " OR e.address LIKE '%".$db->escape($sall)."%'"; - $sql.= " OR e.town LIKE '%".$db->escape($sall)."%')"; -} +if ($search_ref) $sql.= natural_search("e.label", $search_ref); // ref +if ($search_label) $sql.= natural_search("e.lieu", $search_label); // label +if ($search_status != '' && $search_status >= 0) $sql.= " AND e.statut = ".$search_status; +if ($sall) $sql.= natural_search(array('e.label','e.description','e.lieu','e.address','e.town'), $sall); $sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); - +print $sql; $result = $db->query($sql); if ($result) { @@ -87,6 +81,12 @@ if ($result) print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder,'',$num); + print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">'; + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; + print '<input type="hidden" name="action" value="list">'; + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; + print '<table class="noborder" width="100%">'; print "<tr class=\"liste_titre\">"; @@ -95,8 +95,34 @@ if ($result) print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; + // Lignes des champs de filtre + print '<tr class="liste_titre">'; + + print '<td class="liste_titre" align="left">'; + print '<input class="flat" type="text" name="search_ref" size="6" value="'.dol_escape_htmltag($search_ref).'">'; + print '</td>'; + + print '<td class="liste_titre" align="left">'; + print '<input class="flat" type="text" name="search_label" size="10" value="'.dol_escape_htmltag($search_label).'">'; + print '</td>'; + + print '<td class="liste_titre" colspan="2">'; + print '</td>'; + + print '<td class="liste_titre" align="right">'; + print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); + print '</td>'; + + print '<td class="liste_titre nowrap" align="right">'; + print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; + print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; + print '</td>'; + + print '</tr>'; + if ($num) { $entrepot=new Entrepot($db); @@ -128,6 +154,9 @@ if ($result) print '</td>'; // Status print '<td align="right">'.$entrepot->LibStatut($objp->statut,5).'</td>'; + + print '<td></td>'; + print "</tr>\n"; $total += price2num($objp->estimatedvalue,'MU'); @@ -148,7 +177,8 @@ if ($result) print $form->textwithtooltip($langs->trans("Variable"),$htmltext); } print '</td>'; - print '<td align="right"> </td>'; + print '<td></td>'; + print '<td></td>'; print "</tr>\n"; } @@ -156,6 +186,7 @@ if ($result) print "</table>"; + print '</form>'; } else { diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 82c8ded066f4c80e3bffb4f3a8132b60a0aaf1f3..a556798cdd1f5323f061607f48b0e1078aabed8a 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -501,12 +501,12 @@ if ($resql) print '<tr class="liste_titre">'; print '<td class="liste_titre" valign="right">'; - print $langs->trans('Month').': <input class="flat" type="text" size="2" maxlength="2" name="month" value="'.$month.'">'; + print '<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans("Month")).'" name="month" value="'.$month.'">'; if (empty($conf->productbatch->enabled)) print ' '; - else print '<br>'; - print $langs->trans('Year').': '; + //else print '<br>'; $syear = $year?$year:-1; - $formother->select_year($syear,'year',1, 20, 5); + print '<input class="flat" type="text" size="2" maxlength="4" placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" name="year" value="'.($syear > 0 ? $syear : '').'">'; + //print $formother->selectyear($syear,'year',1, 20, 5); print '</td>'; // Product Ref print '<td class="liste_titre" align="left">'; diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php new file mode 100644 index 0000000000000000000000000000000000000000..27335777db12598b01a3589007b0df2b6145a756 --- /dev/null +++ b/htdocs/projet/class/projectstats.class.php @@ -0,0 +1,327 @@ +<?php +/* Lead + * Copyright (C) 2014-2015 Florian HENRY <florian.henry@open-concept.pro> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php'; +include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; + + +class ProjectStats extends Stats +{ + protected $db; + private $project; + public $userid; + public $socid; + public $year; + function __construct($db) { + global $conf, $user; + + $this->db = $db; + + require_once 'project.class.php'; + + $this->project = new Project($this->db); + } + + + /** + * Return all leads grouped by status + * + * @param int $limit Limit results + * @return array|int + * @throws Exception + */ + function getAllProjectByStatus($limit = 5) + { + global $conf, $user, $langs; + + $datay = array (); + + $sql = "SELECT"; + $sql .= " count(DISTINCT t.rowid), t.fk_opp_status"; + $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t"; + $sql .= $this->buildWhere(); + $sql .= " GROUP BY t.fk_opp_status"; + + $result = array (); + $res = array (); + + dol_syslog(get_class($this) . '::' . __METHOD__ . "", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + $other = 0; + while ( $i < $num ) { + $row = $this->db->fetch_row($resql); + if ($i < $limit || $num == $limit) + $result[$i] = array ( + $this->projet->status[$row[1]] . '(' . $row[0] . ')', + $row[0] + ); + else + $other += $row[1]; + $i ++; + } + if ($num > $limit) + $result[$i] = array ( + $langs->transnoentitiesnoconv("Other"), + $other + ); + $this->db->free($resql); + } else { + $this->error = "Error " . $this->db->lasterror(); + dol_syslog(get_class($this) . '::' . __METHOD__ . ' ' . $this->error, LOG_ERR); + return - 1; + } + + return $result; + } + + /** + * Return count, and sum of products + * + * @return array of values + */ + function getAllByYear() + { + global $conf, $user, $langs; + + $datay = array (); + + $sql = "SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb, SUM(t.opp_amount) as total, AVG(t.opp_amount) as avg"; + $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t"; + if (! $user->rights->societe->client->voir && ! $user->societe_id) + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + $sql .= $this->buildWhere(); + $sql .= " GROUP BY year"; + $sql .= $this->db->order('year', 'DESC'); + + return $this->_getAllByYear($sql); + } + /** + * + * @return string + */ + public function buildWhere() { + $sqlwhere_str = ''; + $sqlwhere = array (); + + $sqlwhere[] = ' t.entity IN (' . getEntity('project') . ')'; + + if (! empty($this->userid)) + $sqlwhere[] = ' t.fk_user_resp=' . $this->userid; + if (! empty($this->socid)) + $sqlwhere[] = ' t.fk_soc=' . $this->socid; + if (! empty($this->year) && empty($this->yearmonth)) + $sqlwhere[] = " date_format(t.datec,'%Y')='" . $this->year . "'"; + if (! empty($this->yearmonth)) + $sqlwhere[] = " t.datec BETWEEN '" . $this->db->idate(dol_get_first_day($this->yearmonth)) . "' AND '" . $this->db->idate(dol_get_last_day($this->yearmonth)) . "'"; + + if (! empty($this->status)) + $sqlwhere[] = " t.fk_opp_status IN (" . $this->status . ")"; + + if (count($sqlwhere) > 0) { + $sqlwhere_str = ' WHERE ' . implode(' AND ', $sqlwhere); + } + + return $sqlwhere_str; + } + + /** + * Return Project number by month for a year + * + * @param int $year scan + * @return array of values + */ + function getNbByMonth($year) { + global $user; + + $this->yearmonth = $year; + + $sql = "SELECT date_format(t.datec,'%m') as dm, COUNT(*) as nb"; + $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t"; + if (! $user->rights->societe->client->voir && ! $user->societe_id) + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + $sql .= $this->buildWhere(); + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + $this->yearmonth=0; + + $res = $this->_getNbByMonth($year, $sql); + // var_dump($res);print '<br>'; + return $res; + } + + /** + * Return the Project amount by month for a year + * + * @param int $year scan + * @return array with amount by month + */ + function getAmountByMonth($year) { + global $user; + + $this->yearmonth = $year; + + $sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount)"; + $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t"; + if (! $user->rights->societe->client->voir && ! $user->societe_id) + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + $sql .= $this->buildWhere(); + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + $this->yearmonth=0; + + $res = $this->_getAmountByMonth($year, $sql); + // var_dump($res);print '<br>'; + return $res; + } + + /** + * Return amount of elements by month for several years + * + * @param int $endyear End year + * @param int $startyear Start year + * @param int $cachedelay accept for cache file (0=No read, no save of cache, -1=No read but save) + * @return array of values + */ + function getTransformRateByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0) + { + global $conf, $user, $langs; + + if ($startyear > $endyear) return - 1; + + $datay = array(); + + // Search into cache + if (! empty($cachedelay)) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT . '/core/lib/json.lib.php'; + } + + $newpathofdestfile = $conf->user->dir_temp . '/' . get_class($this) . '_' . __FUNCTION__ . '_' . (empty($this->cachefilesuffix) ? '' : $this->cachefilesuffix . '_') . $langs->defaultlang . '_user' . $user->id . '.cache'; + $newmask = '0644'; + + $nowgmt = dol_now(); + + $foundintocache = 0; + if ($cachedelay > 0) { + $filedate = dol_filemtime($newpathofdestfile); + if ($filedate >= ($nowgmt - $cachedelay)) { + $foundintocache = 1; + + $this->_lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $filedate; + } else { + dol_syslog(get_class($this) . '::' . __FUNCTION__ . " cache file " . $newpathofdestfile . " is not found or older than now - cachedelay (" . $nowgmt . " - " . $cachedelay . ") so we can't use it."); + } + } + + // Load file into $data + if ($foundintocache) // Cache file found and is not too old + { + dol_syslog(get_class($this) . '::' . __FUNCTION__ . " read data from cache file " . $newpathofdestfile . " " . $filedate . "."); + $data = dol_json_decode(file_get_contents($newpathofdestfile), true); + } else { + $year = $startyear; + while ( $year <= $endyear ) { + $datay[$year] = $this->getTransformRateByMonth($year); + $year ++; + } + + $data = array (); + // $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...) + for($i = 0; $i < 12; $i ++) { + $data[$i][] = $datay[$endyear][$i][0]; // set label + $year = $startyear; + while ( $year <= $endyear ) { + $data[$i][] = $datay[$year][$i][1]; // set yval for x=i + $year ++; + } + } + } + + // Save cache file + if (empty($foundintocache) && ($cachedelay > 0 || $cachedelay == - 1)) { + dol_syslog(get_class($this) . '::' . __FUNCTION__ . " save cache file " . $newpathofdestfile . " onto disk."); + if (! dol_is_dir($conf->user->dir_temp)) + dol_mkdir($conf->user->dir_temp); + $fp = fopen($newpathofdestfile, 'w'); + fwrite($fp, dol_json_encode($data)); + fclose($fp); + if (! empty($conf->global->MAIN_UMASK)) + $newmask = $conf->global->MAIN_UMASK; + @chmod($newpathofdestfile, octdec($newmask)); + + $this->_lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $nowgmt; + } + + return $data; + } + + /** + * Return the Project transformation rate by month for a year + * + * @param int $year scan + * @return array with amount by month + */ + function getTransformRateByMonth($year) { + global $user; + + $this->yearmonth = $year; + + $sql = "SELECT date_format(t.datec,'%m') as dm, count(t.opp_amount)"; + $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t"; + if (! $user->rights->societe->client->voir && ! $user->societe_id) + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + $sql .= $this->buildWhere(); + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + $res_total = $this->_getNbByMonth($year, $sql); + + $this->status=6; + + $sql = "SELECT date_format(t.datec,'%m') as dm, count(t.opp_amount)"; + $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t"; + if (! $user->rights->societe->client->voir && ! $user->societe_id) + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + $sql .= $this->buildWhere(); + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + $this->status=0; + $this->yearmonth=0; + + $res_only_wined = $this->_getNbByMonth($year, $sql); + + $res=array(); + + foreach($res_total as $key=>$total_row) { + //var_dump($total_row); + if (!empty($total_row[1])) { + $res[$key]=array($total_row[0],(100*$res_only_wined[$key][1])/$total_row[1]); + } else { + $res[$key]=array($total_row[0],0); + } + + } + // var_dump($res);print '<br>'; + return $res; + } +} \ No newline at end of file diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 489f85f7405cace2bbfbe61c37a4adac75fb2d35..abe0a5858fcb6ef4d4b994e550fc551b7fbe2fee 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -281,7 +281,7 @@ if ($resql) if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print_liste_field_titre($langs->trans("OpportunityStatus"),$_SERVER["PHP_SELF"],'p.fk_opp_statut',"",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; print '<tr class="liste_titre">'; @@ -331,7 +331,7 @@ if ($resql) print '<td class="liste_titre nowrap" align="right">'; print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('Draft'),'1'=>$langs->trans('Opened'),'2'=>$langs->trans('Closed')),$search_status); print '</td>'; - print '<td width="56">'; + print '<td>'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '</td>'; diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php new file mode 100644 index 0000000000000000000000000000000000000000..fdb272ed70eb1ff7de0b98618db8d226523b8ed9 --- /dev/null +++ b/htdocs/projet/stats/index.php @@ -0,0 +1,367 @@ +<?php +/* Lead + * Copyright (C) 2014-2015 Florian HENRY <florian.henry@open-concept.pro> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/projectstats.class.php'; + +// Security check +if (! $user->rights->projet->lire) + accessforbidden(); + + +$WIDTH=DolGraph::getDefaultGraphSizeForStats('width'); +$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); + +$userid=GETPOST('userid','int'); +$socid=GETPOST('socid','int'); +// Security check +if ($user->societe_id > 0) +{ + $action = ''; + $socid = $user->societe_id; +} +$nowyear=strftime("%Y", dol_now()); +$year = GETPOST('year')>0?GETPOST('year'):$nowyear; +//$startyear=$year-2; +$startyear=$year-1; +$endyear=$year; + +$langs->load('projects'); + + +/* + * View + */ + +$form=new Form($db); + +$includeuserlist=array(); + + +llxHeader('', $langs->trans('Projects')); + +$title=$langs->trans("ProjectsStatistics"); +$dir=$conf->projet->dir_output.'/temp'; + +print_fiche_titre($title,'','title_project.png'); + +dol_mkdir($dir); + + +$stats_project= new ProjectStats($db); +if (!empty($userid) && $userid!=-1) $stats_project->userid=$userid; +if (!empty($socid) && $socid!=-1) $stats_project->socid=$socid; +if (!empty($year)) $stats_project->year=$year; + + + +if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) +{ + $data1 = $stats_project->getAllProjectByStatus(); + if (!is_array($data1) && $data1<0) { + setEventMessages($stats_project->error, null, 'errors'); + } + if (empty($data1)) + { + $showpointvalue=0; + $nocolor=1; + $data1=array(array(0=>$langs->trans("None"),1=>1)); + } + + $filenamenb = $conf->project->dir_output . "/stats/projectbystatus.png"; + $fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=projectstats&file=projectbystatus.png'; + $px = new DolGraph(); + $mesg = $px->isGraphKo(); + if (empty($mesg)) { + $i=0;$tot=count($data1);$legend=array(); + while ($i <= $tot) + { + $data1[$i][0]=$data1[$i][0]; // Required to avoid error "Could not draw pie with labels contained inside canvas" + $legend[]=$data1[$i][0]; + $i++; + } + $px->SetData($data1); + unset($data1); + + if ($nocolor) + $px->SetDataColor(array ( + array ( + 220, + 220, + 220 + ) + )); + $px->SetPrecisionY(0); + $px->SetLegend($legend); + $px->setShowLegend(0); + $px->setShowPointValue($showpointvalue); + $px->setShowPercent(1); + $px->SetMaxValue($px->GetCeilMaxValue()); + $px->SetWidth(300); + $px->SetHeight(300); + $px->SetShading(3); + $px->SetHorizTickIncrement(1); + $px->SetCssPrefix("cssboxes"); + $px->SetType(array ( + 'pie' + )); + $px->SetTitle($langs->trans('ProjectNbProjectByStatus')); + $result=$px->draw($filenamenb, $fileurlnb); + if ($result<0) { + setEventMessages($px->error, null, 'errors'); + } + } else { + setEventMessages(null, $mesgs, 'errors'); + } +} + + +// Build graphic number of object +// $data = array(array('Lib',val1,val2,val3),...) +$data = $stats_project->getNbByMonthWithPrevYear($endyear,$startyear); +//var_dump($data); + +$filenamenb = $conf->project->dir_output . "/stats/projectnbprevyear-".$year.".png"; +$fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=projectstats&file=projectnbprevyear-'.$year.'.png'; + +$px1 = new DolGraph(); +$mesg = $px1->isGraphKo(); +if (! $mesg) +{ + $px1->SetData($data); + $px1->SetPrecisionY(0); + $i=$startyear;$legend=array(); + while ($i <= $endyear) + { + $legend[]=$i; + $i++; + } + $px1->SetLegend($legend); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetWidth($WIDTH); + $px1->SetHeight($HEIGHT); + $px1->SetYLabel($langs->trans("ProjectNbProject")); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->SetPrecisionY(0); + $px1->mode='depth'; + $px1->SetTitle($langs->trans("ProjectNbProjectByMonth")); + + $px1->draw($filenamenb,$fileurlnb); +} + + +if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) +{ + // Build graphic amount of object + $data = $stats_project->getAmountByMonthWithPrevYear($endyear,$startyear); + //var_dump($data); + // $data = array(array('Lib',val1,val2,val3),...) + + $filenamenb = $conf->project->dir_output . "/stats/projectamountprevyear-".$year.".png"; + $fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=projectstats&file=projectamountprevyear-'.$year.'.png'; + + $px2 = new DolGraph(); + $mesg = $px2->isGraphKo(); + if (! $mesg) + { + $px2->SetData($data); + $i=$startyear;$legend=array(); + while ($i <= $endyear) + { + $legend[]=$i; + $i++; + } + $px2->SetLegend($legend); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue(min(0,$px2->GetFloorMinValue())); + $px2->SetWidth($WIDTH); + $px2->SetHeight($HEIGHT); + $px2->SetYLabel($langs->trans("ProjectAmountOfProject")); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetPrecisionY(0); + $px2->mode='depth'; + $px2->SetTitle($langs->trans("ProjectAmountOfProjectsByMonth")); + + $px2->draw($filenamenb,$fileurlnb); + } +} + +if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) +{ + // Build graphic with transformation rate + $data = $stats_project->getTransformRateByMonthWithPrevYear($endyear,$startyear); + //var_dump($data); + // $data = array(array('Lib',val1,val2,val3),...) + + $filenamenb = $conf->project->dir_output . "/stats/projecttransrateprevyear-".$year.".png"; + $fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=projectstats&file=projecttransrateprevyear-'.$year.'.png'; + + $px3 = new DolGraph(); + $mesg = $px3->isGraphKo(); + if (! $mesg) + { + $px3->SetData($data); + $i=$startyear;$legend=array(); + while ($i <= $endyear) + { + $legend[]=$i; + $i++; + } + $px3->SetLegend($legend); + $px3->SetMaxValue($px3->GetCeilMaxValue()); + $px3->SetMinValue(min(0,$px3->GetFloorMinValue())); + $px3->SetWidth($WIDTH); + $px3->SetHeight($HEIGHT); + $px3->SetYLabel($langs->trans("ProjectTransRateOfProject")); + $px3->SetShading(3); + $px3->SetHorizTickIncrement(1); + $px3->SetPrecisionY(0); + $px3->mode='depth'; + $px3->SetTitle($langs->trans("ProjectTransRateOfProjectsByMonth")); + + $px3->draw($filenamenb,$fileurlnb); + } +} + + +// Show array +$stats_project->year=0; +$data_all_year = $stats_project->getAllByYear(); +if (!empty($year)) $stats_project->year=$year; +$arrayyears=array(); +foreach($data_all_year as $val) { + $arrayyears[$val['year']]=$val['year']; +} +if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; + + +$h=0; +$head = array(); +$head[$h][0] = DOL_URL_ROOT . '/projet/stats/index.php?mode='.$mode; +$head[$h][1] = $langs->trans("ByMonthYear"); +$head[$h][2] = 'byyear'; +$h++; + +complete_head_from_modules($conf,$langs,null,$head,$h,$type); + +dol_fiche_head($head,'byyear',$langs->trans("Statistics"), 0, ''); + + +print '<div class="fichecenter"><div class="fichethirdleft">'; + +print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; +print '<table class="border" width="100%">'; +print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>'; +// Company +print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; +if ($mode == 'customer') $filter='s.client in (1,2,3)'; +if ($mode == 'supplier') $filter='s.fournisseur = 1'; +print $form->select_company($socid,'socid',$filter,1); +print '</td></tr>'; +// User +/*print '<tr><td>'.$langs->trans("ProjectCommercial").'</td><td>'; +print $form->select_dolusers($userid, 'userid', 1, array(),0,$includeuserlist); +print '</td></tr>';*/ +// Year +print '<tr><td>'.$langs->trans("Year").'</td><td>'; +if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; +if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear; +arsort($arrayyears); +print $form->selectarray('year',$arrayyears,$year,0); +print '</td></tr>'; +print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>'; +print '</table>'; +print '</form>'; +print '<br><br>'; + +print '<table class="border" width="100%">'; +print '<tr height="24">'; +print '<td align="center">'.$langs->trans("Year").'</td>'; +print '<td align="center">'.$langs->trans("NbOfProjects").'</td>'; +if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) +{ + print '<td align="center">'.$langs->trans("AmountTotal").'</td>'; + print '<td align="center">'.$langs->trans("AmountAverage").'</td>'; +} +print '</tr>'; + +$oldyear=0; +foreach ($data_all_year as $val) +{ + $year = $val['year']; + while ($year && $oldyear > $year+1) + { // If we have empty year + $oldyear--; + print '<tr height="24">'; + print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>'; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print '<td align="right">0</td>'; + print '<td align="right">0</td>'; + } + print '<td align="right">0</td>'; + print '</tr>'; + } + print '<tr height="24">'; + print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>'; + print '<td align="right">'.$val['nb'].'</td>'; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>'; + print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>'; + } + print '</tr>'; + $oldyear=$year; +} + +print '</table>'; + +print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; + +$stringtoshow.= '<table class="border" width="100%"><tr valign="top"><td align="center">'; +if ($mesg) { print $mesg; } +else { + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + $stringtoshow.= $px->show(); + $stringtoshow.= "<br>\n"; + } + $stringtoshow.= $px1->show(); + $stringtoshow.= "<br>\n"; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + $stringtoshow.= $px2->show(); + $stringtoshow.= "<br>\n"; + $stringtoshow.= $px3->show(); + } +} +$stringtoshow.= '</td></tr></table>'; + +print $stringtoshow; + + +print '</div></div></div>'; +print '<div style="clear:both"></div>'; + + +llxFooter(); +$db->close(); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 4648992506b0d9c5975ec1430c8abb2874a0b31b..847c23c671913f7acc4a5d683e29e61a574dff9f 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> - * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 1019e7ee16742a71673b445aa630aebb3be3f620..281746fe824b79d7d288577c37e81ee753c7e43b 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -337,6 +337,7 @@ if ($resql) $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_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; // Fields title search @@ -390,11 +391,13 @@ if ($resql) print $hookmanager->resPrint; // Status + print '<td></td>'; + print '<td class="liste_titre" align="right">'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; - print ' '; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '</td>'; + print "</tr>\n"; $var=True; @@ -452,7 +455,9 @@ if ($resql) print $hookmanager->resPrint; // Status - print '<td align="right">'.$companystatic->getLibStatut(3).'</td>'; + print '<td align="right">'.$companystatic->getLibStatut(5).'</td>'; + + print '<td></td>'; print '</tr>'."\n"; $i++; diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 4bf13f0b3904c0ef1607ce05179d49b39a800090..57ca545a05301dcebd3bb32a356f6b9fe5250ab1 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -377,7 +377,7 @@ if ($socid && $action != 'edit' && $action != "create") print '<td>'.$langs->trans("WithdrawMode").'</td>'; } print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"'); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; foreach ($rib_list as $rib) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 00f137252e27eebb72ec16885bd5f8695095aad4..ba094124462b723ab193214b5c031bb1f79afb46 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -404,7 +404,9 @@ th .button { -webkit-border-radius:0px !important; border-radius:0px !important; } - +.maxwidthsearch { /* Max width of column with the search picto */ + width: 54px; +} .valignmiddle { vertical-align: middle; } diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 80a5c52a2327dfc436d0391b454ebea8b625b804..a6c845ee69ff6bbb001c4d6df62e658981e6d400 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -139,7 +139,7 @@ if ($result) print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u2.login",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER['PHP_SELF'],"u.statut",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre(''); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; // Search bar