diff --git a/dev/initdata/img/applepieproduct.jpg b/dev/initdata/img/applepieproduct.jpg new file mode 100644 index 00000000000..f63ddacc770 Binary files /dev/null and b/dev/initdata/img/applepieproduct.jpg differ diff --git a/dev/initdata/img/dolidroid_114x114.png b/dev/initdata/img/dolidroid_114x114.png new file mode 100644 index 00000000000..88c6bf0c3da Binary files /dev/null and b/dev/initdata/img/dolidroid_114x114.png differ diff --git a/dev/initdata/img/dolidroid_512x512_en.png b/dev/initdata/img/dolidroid_512x512_en.png new file mode 100644 index 00000000000..9de25fb5ce9 Binary files /dev/null and b/dev/initdata/img/dolidroid_512x512_en.png differ diff --git a/dev/initdata/img/dolidroid_screenshot_home_720x1280.png b/dev/initdata/img/dolidroid_screenshot_home_720x1280.png new file mode 100644 index 00000000000..34bcfbb6628 Binary files /dev/null and b/dev/initdata/img/dolidroid_screenshot_home_720x1280.png differ diff --git a/dev/initdata/img/genericcustomer.png b/dev/initdata/img/genericcustomer.png new file mode 100644 index 00000000000..4c41073c3fa Binary files /dev/null and b/dev/initdata/img/genericcustomer.png differ diff --git a/dev/initdata/img/indiancompany.png b/dev/initdata/img/indiancompany.png new file mode 100644 index 00000000000..f38da8ae4b1 Binary files /dev/null and b/dev/initdata/img/indiancompany.png differ diff --git a/dev/initdata/img/logo_nltechno_94x100.png b/dev/initdata/img/logo_nltechno_94x100.png new file mode 100644 index 00000000000..7e00ab58884 Binary files /dev/null and b/dev/initdata/img/logo_nltechno_94x100.png differ diff --git a/dev/initdata/img/nocountrycomp.png b/dev/initdata/img/nocountrycomp.png new file mode 100644 index 00000000000..71db7eed091 Binary files /dev/null and b/dev/initdata/img/nocountrycomp.png differ diff --git a/dev/initdata/img/pearpieproduct.jpg b/dev/initdata/img/pearpieproduct.jpg new file mode 100644 index 00000000000..3eb696c54bf Binary files /dev/null and b/dev/initdata/img/pearpieproduct.jpg differ diff --git a/dev/initdata/img/pinkdressproduct.jpg b/dev/initdata/img/pinkdressproduct.jpg new file mode 100644 index 00000000000..f38b413f8e5 Binary files /dev/null and b/dev/initdata/img/pinkdressproduct.jpg differ diff --git a/dev/initdata/img/printcompany.png b/dev/initdata/img/printcompany.png index f3e51e3b5a7..b745fc77174 100644 Binary files a/dev/initdata/img/printcompany.png and b/dev/initdata/img/printcompany.png differ diff --git a/dev/initdata/img/rolluproduct.jpg b/dev/initdata/img/rolluproduct.jpg new file mode 100644 index 00000000000..0ba89e82d66 Binary files /dev/null and b/dev/initdata/img/rolluproduct.jpg differ diff --git a/dev/initdata/img/spanishcompany.png b/dev/initdata/img/spanishcompany.png new file mode 100644 index 00000000000..730d8382aa0 Binary files /dev/null and b/dev/initdata/img/spanishcompany.png differ diff --git a/dev/initdata/img/swisstouch.png b/dev/initdata/img/swisstouch.png new file mode 100644 index 00000000000..49dcb0aeb6d Binary files /dev/null and b/dev/initdata/img/swisstouch.png differ diff --git a/dev/initdata/img/teclibcompany.png b/dev/initdata/img/teclibcompany.png new file mode 100644 index 00000000000..23e65218842 Binary files /dev/null and b/dev/initdata/img/teclibcompany.png differ diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index ed8f8ed976e..f4fb280ef9d 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2016 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,6 +53,9 @@ class modMyModule extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "other"; + // Gives the possibility to the module, to provide his own family info and position of this family. (canceled $this->family) + $this->familyinfo = array('myownfamily' => array('position' => '001', 'label' => $langs->trans("MyOwnFamily"))); + // Module position in the family $this->module_position = 500; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 7239ee89a4b..b43235ca1ec 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -177,7 +177,7 @@ if ($action == 'edit') $var=false; print ''; - print ''.$langs->trans("MAIN_DISABLE_METEO").'' .$form->selectyesno('MAIN_DISABLE_METEO',(isset($conf->global->MAIN_DISABLE_METEO)?1:0),1) . ''; + print ''.$langs->trans("MAIN_DISABLE_METEO").'' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . ''; print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 911372733f1..418e164bc94 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -9,6 +9,7 @@ * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2011-2015 Alexandre Spangaro + * Copyright (C) 2015 Ferran Marcet * * 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 diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 92cc7d3bff5..3fbaddd0a3f 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -142,10 +142,10 @@ foreach ($modulesdir as $dir) if (! $objMod->numero > 0) { - dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR); + dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR); } $j = $objMod->numero; - + $modulequalified=1; // We discard modules according to features level (PS: if module is activated we always show it) @@ -161,17 +161,25 @@ foreach ($modulesdir as $dir) { $modules[$i] = $objMod; $filename[$i]= $modName; - + $special = $objMod->special; - $familykey = $objMod->family; + + // Gives the possibility to the module, to provide his own family info and position of this family + if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) { + $familyinfo = array_merge($familyinfo, $objMod->familyinfo); + $familykey = key($objMod->familyinfo); + } else { + $familykey = $objMod->family; + } + $moduleposition = ($objMod->module_position?$objMod->module_position:'500'); if ($moduleposition == 500 && ($objMod->isCoreOrExternalModule() == 'external')) { $moduleposition = 800; } - + if ($special == 1) $familykey='interface'; - + $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number $dirmod[$i] = $dir; // Set categ[$i] @@ -323,7 +331,7 @@ if ($mode != 'marketplace') $objMod = $modules[$key]; $special = $objMod->special; - + //print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."
"; //if (($mode != (isset($specialtostring[$special])?$specialtostring[$special]:'unknown') && $mode != 'expdev') if (($special >= 4 && $mode != 'expdev') diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index e8a355dd1e3..19633aa13d7 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -755,7 +755,7 @@ if ($action == 'create') { $events=array(); - $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); + $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); //For external user force the company to user company if (!empty($user->societe_id)) { print $form->select_thirdparty_list($user->societe_id,'socid','',1,1,0,$events); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 68eb6994e5a..e91ffe18d45 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -421,6 +421,20 @@ class ActionComm extends CommonObject $this->id=0; + if (!is_object($fuser)) + { + if ($fuser > 0) + { + $u = new User($db); + $u->fetch($fuser); + $fuser = $u; + } + else + { + $fuser = $user; + } + } + // Create clone $result=$this->add($fuser); if ($result < 0) $error++; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 622e5445b1f..913b46a852b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -87,11 +87,18 @@ $pid=GETPOST("projectid","int",3); $status=GETPOST("status"); $type=GETPOST("type"); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); -$actioncode=GETPOST("actioncode","array",3) ? GETPOST("actioncode","array",3):(GETPOST("actioncode")=='0'?'0':''); -if(is_array($actioncode))$actioncode =implode(',', $actioncode); +// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) +if (GETPOST('actioncode','array')) +{ + $actioncode=GETPOST('actioncode','array',3); + if (! count($actioncode)) $actioncode='0'; +} +else +{ + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); +} +if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); - -if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index bedf50f00b4..447a247ad56 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -43,6 +43,7 @@ $pid=GETPOST("projectid",'int',3); $status=GETPOST("status",'alpha'); $type=GETPOST('type'); $optioncss = GETPOST('optioncss','alpha'); +// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) if (GETPOST('actioncode','array')) { $actioncode=GETPOST('actioncode','array',3); @@ -50,12 +51,13 @@ if (GETPOST('actioncode','array')) } else { - $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } +if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); + $dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear')); $datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth'), GETPOST('datestartday'), GETPOST('datestartyear')); $dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth'), GETPOST('dateendday'), GETPOST('dateendyear')); -if (empty($actioncode) && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); @@ -164,7 +166,7 @@ llxHeader('',$langs->trans("Agenda"),$help_url); $listofextcals=array(); $param=''; -if ($actioncode) $param.="&actioncode=".$actioncode; +if ($actioncode != '') $param.="&actioncode=".$actioncode; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; if ($filtert) $param.="&filtert=".$filtert; @@ -287,6 +289,7 @@ if ($resql) print ''; print ''; print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); @@ -297,6 +300,11 @@ if ($resql) print ''; print ''; + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) + { + print ''; + //print ''; + } print ''; @@ -316,6 +324,10 @@ if ($resql) $now=dol_now(); $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; + $caction=new CActionComm($db); + $arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0)); + $var=true; while ($i < min($num,$limit)) { @@ -341,6 +353,13 @@ if ($resql) print $actionstatic->getNomUrl(1,28); print ''; + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) + { + $labeltype=$obj->type_code; + if (! empty($arraylist[$labeltype])) $labeltype=$arraylist[$labeltype]; + print ''; + } + // Start date print ''; } print "
'; print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1); print ''.dol_trunc($labeltype,24).''; print dol_print_date($db->jdate($obj->dp),"dayhour"); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 4037d07de43..318e96f7122 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -85,7 +85,17 @@ $pid=GETPOST("projectid","int",3); $status=GETPOST("status"); $type=GETPOST("type"); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); -$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':''); +// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) +if (GETPOST('actioncode','array')) +{ + $actioncode=GETPOST('actioncode','array',3); + if (! count($actioncode)) $actioncode='0'; +} +else +{ + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); +} +if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); $dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear')); if ($dateselect > 0) @@ -111,7 +121,6 @@ if ($begin_d < 1 || $begin_d > 7) $begin_d = 1; if ($end_d < 1 || $end_d > 7) $end_d = 7; if ($end_d < $begin_d) $end_d = $begin_d + 1; -if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); @@ -278,7 +287,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param); $head = calendars_prepare_head($paramnoaction); 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, 'systemauto'); +print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup); dol_fiche_end(); $showextcals=$listofextcals; @@ -677,7 +686,7 @@ else // Load array of colors by type $colorsbytype=array(); $labelbytype=array(); -$sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm"; +$sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm ORDER BY position"; $resql=$db->query($sql); while ($obj = $db->fetch_object($resql)) { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index ddacf259ae4..93f9b243624 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -194,6 +194,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) } else { + $var=!$var; print '
'.$langs->trans("NoProposal").'

"; @@ -273,6 +274,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) } else { + $var=!$var; print ''.$langs->trans("NoOrder").''; } print "
"; @@ -353,6 +355,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande } else { + $var=!$var; print ''.$langs->trans("NoSupplierOrder").''; } print "
"; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index dbe0722c77d..8a2ee5bce35 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -276,7 +276,7 @@ if ($action == 'create') // Label print ''.$langs->trans("LabelBankCashAccount").''; - print ''; + print ''; // Type print ''.$langs->trans("AccountType").''; @@ -477,19 +477,19 @@ if ($action == 'create') if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { print ''.$langs->trans("AccountancyCode").''; - print 'account_number).'">'; + print 'account_number).'">'; } else { print ''.$langs->trans("AccountancyCode").''; - print 'account_number).'">'; + print 'account_number).'">'; } // Accountancy journal if (! empty($conf->accounting->enabled)) { print ''.$langs->trans("AccountancyJournal").''; - print 'accountancy_journal).'">'; + print 'accountancy_journal).'">'; } print ''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index de1cba15e17..eb3f969890b 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3667,7 +3667,7 @@ else if ($id > 0 || ! empty($ref)) } else { - print ''; + print ''; } } diff --git a/htdocs/compta/hrm.php b/htdocs/compta/hrm.php index 2f176bc0c32..08ca07b04c5 100644 --- a/htdocs/compta/hrm.php +++ b/htdocs/compta/hrm.php @@ -142,7 +142,7 @@ $langs->load("boxes"); -// Last expense report (new module) +// Last leave requests if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status"; @@ -207,7 +207,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '
'; } diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 7b797b98ab0..3848960e5e9 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -170,6 +170,8 @@ class box_graph_invoices_permonth extends ModeleBoxes $mesg = $px2->isGraphKo(); if (! $mesg) { + $langs->load("bills"); + $px2->SetData($data2); unset($data2); $px2->SetPrecisionY(0); diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 31d9f811257..0931d2d05df 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -169,6 +169,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $mesg = $px2->isGraphKo(); if (! $mesg) { + $langs->load("bills"); + $px2->SetData($data2); unset($data2); $px2->SetPrecisionY(0); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2929b66e80c..78f544cc8ab 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2918,6 +2918,7 @@ abstract class CommonObject /** * Return if a country is inside the EEC (European Economic Community) + * TODO Add a field into dictionary * * @return boolean true = country inside EEC, false = country outside EEC */ @@ -2939,7 +2940,8 @@ abstract class CommonObject 'FR', // France 'GB', // United Kingdom 'GR', // Greece - 'NL', // Holland + 'HR', // Croatia + 'NL', // Holland 'HU', // Hungary 'IE', // Ireland 'IM', // Isle of Man - Included in UK @@ -2949,7 +2951,7 @@ abstract class CommonObject 'LV', // Latvia 'MC', // Monaco - Included in France 'MT', // Malta - //'NO', // Norway + //'NO', // Norway 'PL', // Poland 'PT', // Portugal 'RO', // Romania @@ -4099,7 +4101,7 @@ abstract class CommonObject } if($extrafields->attribute_required[$key]) - $label = ''.$label.''; + $label = ''.$label.''; $out .= ''.$langs->trans($label).''; $out .=''; diff --git a/htdocs/core/lib/categories.lib.php b/htdocs/core/lib/categories.lib.php index f03a313ce2a..4be484e1aa4 100644 --- a/htdocs/core/lib/categories.lib.php +++ b/htdocs/core/lib/categories.lib.php @@ -49,11 +49,14 @@ function categories_prepare_head($object,$type) $head[$h][2] = 'photos'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&type='.$type; - $head[$h][1] = $langs->trans("Translation"); - $head[$h][2] = 'translation'; - $h++; - + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&type='.$type; + $head[$h][1] = $langs->trans("Translation"); + $head[$h][2] = 'translation'; + $h++; + } + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0e6214560c4..f7f1ae3541b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1118,7 +1118,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e if (! is_object($outputlangs)) $outputlangs=$langs; if (! $format) $format='daytextshort'; $reduceformat=(! empty($conf->dol_optimize_smallscreen) && in_array($format,array('day','dayhour')))?1:0; - + $formatwithoutreduce = preg_replace('/reduceformat/','',$format); + if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat=1; } // so format 'dayreduceformat' is processed like day + // Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default. if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short); else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short); @@ -1560,9 +1562,10 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64) * @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx * @param string $withpicto Show picto * @param string $titlealt Text to show on alt + * @param int $adddivfloat Add div float around phone. * @return string Formated phone number */ -function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$separ=" ",$withpicto='',$titlealt='') +function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$separ=" ",$withpicto='',$titlealt='',$adddivfloat=0) { global $conf,$user,$langs,$mysoc; @@ -1646,7 +1649,13 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep { $titlealt=($withpicto=='fax'?$langs->trans("Fax"):$langs->trans("Phone")); } - return '
'.($withpicto?img_picto($titlealt, 'object_'.($withpicto=='fax'?'phoning_fax':'phoning').'.png').' ':'').$newphone.'
'; + $rep=''; + if ($adddivfloat) $rep.='
'; + else $rep.=''; + $rep.=($withpicto?img_picto($titlealt, 'object_'.($withpicto=='fax'?'phoning_fax':'phoning').'.png').' ':'').$newphone; + if ($adddivfloat) $rep.='
'; + else $rep.=''; + return $rep; } /** diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 528abfcd6a5..03eb651e4db 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -93,10 +93,14 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt //dol_syslog("Price.lib::calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate.' remise_percent_global='.$remise_percent_global.' price_base_type='.$ice_base_type.' type='.$type.' progress='.$progress); $countryid=$seller->country_id; + + if (is_numeric($uselocaltax1_rate)) $uselocaltax1_rate=(float) $uselocaltax1_rate; + if (is_numeric($uselocaltax2_rate)) $uselocaltax2_rate=(float) $uselocaltax2_rate; + if ($uselocaltax1_rate < 0) $uselocaltax1_rate=$seller->localtax1_assuj; if ($uselocaltax2_rate < 0) $uselocaltax2_rate=$seller->localtax2_assuj; - dol_syslog('Price.lib::calcul_price_total qty='.$qty.' pu='.$pu.' remise_percent_ligne='.$remise_percent_ligne.' txtva='.$txtva.' uselocaltax1_rate='.$uselocaltax1_rate.' uselocaltax2_rate='.$uselocaltax2_rate.' remise_percent_global='.$remise_percent_global.' price_base_type='.$ice_base_type.' type='.$type.' progress='.$progress); + dol_syslog('Price.lib::calcul_price_total qty='.$qty.' pu='.$pu.' remise_percent_ligne='.$remise_percent_ligne.' txtva='.$txtva.' uselocaltax1_rate='.$uselocaltax1_rate.' uselocaltax2_rate='.$uselocaltax2_rate.' remise_percent_global='.$remise_percent_global.' price_base_type='.$price_base_type.' type='.$type.' progress='.$progress); // Now we search localtaxes information ourself (rates and types). $localtax1_type=0; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index efbaa78557e..d354721332a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -794,17 +794,19 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]; $alreadyspent=''; if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); + $alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']); + $tableCell =''; - $tableCell.=''; - //$placeholder=' placeholder="00:00"'; - $placeholder=''; - //if (! $disabledtask) - //{ - $tableCell.='+'; - $tableCell.=''; - //} + if ($alreadyspent) + { + $tableCell.=''; + //$placeholder=' placeholder="00:00"'; + $placeholder=''; + //$tableCell.='+'; + } + $tableCell.=''; $tableCell.=''; print $tableCell; } diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 50e3b1e97be..8cfd5f202d5 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -50,9 +50,12 @@ function shipping_prepare_head($object) { // delivery link $object->fetchObjectLinked($object->id,$object->element); - if (! empty($object->linkedObjectsIds['delivery'][0])) // If there is a delivery + if (count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery { - $head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$object->linkedObjectsIds['delivery'][0]; + // Take first one element of array + $tmp = reset($object->linkedObjectsIds['delivery']); + + $head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$tmp; $head[$h][1] = $langs->trans("DeliveryCard"); $head[$h][2] = 'delivery'; $h++; @@ -302,7 +305,8 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $expedition->id=$objp->sendingid; $expedition->fetchObjectLinked($expedition->id,$expedition->element); //var_dump($expedition->linkedObjects); - $receiving=(! empty($expedition->linkedObjects['delivery'][0])?$expedition->linkedObjects['delivery'][0]:''); + $receiving=''; + if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link if (! empty($receiving)) { diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d8f940767b9..68e35536f1b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -645,11 +645,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->categorie->enabled)) { $langs->load("categories"); - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { // Categories prospects/customers - $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - $newmenu->add("/categories/card.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + $menutoshow=$langs->trans("CustomersProspectsCategoriesShort"); + if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $menutoshow=$langs->trans("CustomersCategoriesShort"); + if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $menutoshow=$langs->trans("ProspectsCategoriesShort"); + $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + $newmenu->add("/categories/card.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } // Categories Contact $newmenu->add("/categories/index.php?leftmenu=cat&type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); @@ -1011,8 +1014,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->accounting->enabled)) { $langs->load("admin"); - - $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); + $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy", $langs->trans("Chartofaccounts"),0,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount'); } } diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 21944afad4f..56af3a40cd2 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -254,7 +254,7 @@ class pdf_strato extends ModelePDFContract { $objectligne = $object->lines[$i]; - $valide = $objectligne->id ? $objectligne->fetch($objectligne->id) : 0; + $valide = $objectligne->id ? 1 : 0; if ($valide > 0 || $object->specimen) { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index e967f6781ea..7a4621cc396 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -250,6 +250,9 @@ class pdf_crabe extends ModelePDFFactures global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + // Set nblignes with the new facture lines content after hook + $nblignes = count($object->lines); + // Create pdf instance $pdf=pdf_getInstance($this->format); $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index 2aa81102fa8..b2bc41220c3 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -77,7 +77,11 @@ class modMargin extends DolibarrModules $this->langfiles = array("margins"); // Constants - $this->const = array(); // List of particular constants to add when module is enabled + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) + // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), + // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) + // ); + $this->const = array(0=>array('MARGIN_TYPE','chaine','1','Rule for margin calculation by default',0,'current',0)); // List of particular constants to add when module is enabled // New pages on tabs $this->tabs = array( diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php index 2ab7a8aa54f..5d5b327deaf 100644 --- a/htdocs/core/modules/modOpenSurvey.class.php +++ b/htdocs/core/modules/modOpenSurvey.class.php @@ -51,7 +51,7 @@ class modOpenSurvey extends DolibarrModules // Family can be 'crm','financial','hr','projects','product','technic','other' // It is used to group modules in module setup page - $this->family = "projects"; + $this->family = "portal"; $this->module_position = 40; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index af2f630b54c..8de0d100194 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -116,8 +116,8 @@ class modProjet extends DolibarrModules $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; - - $this->const[$r][0] = "PROJECT_USE_OPPORTUNIES"; + + $this->const[$r][0] = "PROJECT_USE_OPPORTUNITIES"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "1"; $this->const[$r][3] = ""; diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 31172a32f43..2b60695db51 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -585,9 +585,9 @@ class doc_generic_task_odt extends ModelePDFTask $odfHandler->mergeSegment($listlinestaskres); } - //Time ressources + // Time ressources $sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note"; - $sql.= ", u.name, u.firstname"; + $sql.= ", u.lastname, u.firstname"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql .= " , ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE t.fk_task =".$object->id; @@ -607,6 +607,7 @@ class doc_generic_task_odt extends ModelePDFTask if (!empty($row['fk_user'])) { $objectdetail=new User($this->db); $objectdetail->fetch($row['fk_user']); + // TODO Use a cache to aoid fetch for same user $row['fullcivname']=$objectdetail->getFullName($outputlangs,1); } else { $row['fullcivname']=''; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 006b349c965..b881f45dab0 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -1088,7 +1088,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0,0,60); $usehourmin='day'; - if (empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin='dayhour'; + if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin='dayhour'; if (! empty($object->date_livraison)) { $posy+=4; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 4316ab0b318..4de0bfd1743 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -341,7 +341,7 @@ if (! empty($conf->margin->enabled)) setTimeout(function () { rate.focus() }, 50); return false; } - if (npRate == "np_markRate" && rate.val() >= 100) + if (npRate == "np_markRate" && rate.val() > 100) { alert('transnoentitiesnoconv("markRateShouldBeLesserThan100"); ?>'); e.stopPropagation(); @@ -362,7 +362,7 @@ if (! empty($conf->margin->enabled)) price = ((bpjs * (1 + (ratejs / 100))) / (1 - remisejs / 100)); else if (npRate == "np_markRate") { - if (ratejs != 100) + if (ratejs != 100) // If markRate is 100, it means buying price is 0, so it is not possible to retreive price from it and markRate. We keep it unchange { price = ((bpjs / (1 - (ratejs / 100))) / (1 - remisejs / 100)); } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3136e5a79b7..e565d015a93 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -338,7 +338,7 @@ if (empty($reshook)) $result = $object->create_delivery($user); if ($result > 0) { - header("Location: ".DOL_URL_ROOT.'/livraison/card.php?id='.$result); + header("Location: ".DOL_URL_ROOT.'/livraison/card.php?action=create_delivery&id='.$result); exit; } else @@ -529,7 +529,7 @@ if ($action == 'create2') $action=''; $id=''; $ref=''; } -// Mode creation +// Mode creation. TODO This part seems to not be used at all. Receipt record is created by the action "create_delivery" not from a form. if ($action == 'create') { $expe = new Expedition($db); @@ -1583,7 +1583,8 @@ else if ($id || $ref) } // This is just to generate a delivery receipt - if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery'][0])) + //var_dump($object->linkedObjectsIds['delivery']); + if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && count($object->linkedObjectsIds['delivery']) == 0) { print ''.$langs->trans("CreateDeliveryOrder").''; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 30607201e73..9ad2108519a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -789,9 +789,9 @@ class Expedition extends CommonObject /** - * Cree un bon de livraison a partir de l'expedition + * Create a delivery receipt from a shipment * - * @param User $user Utilisateur + * @param User $user User * @return int <0 if KO, >=0 if OK */ function create_delivery($user) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 00796add031..30e276cca20 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -102,7 +102,7 @@ if ($socid) { $sql.= " AND e.fk_soc = ".$socid; } -if ($viewstatut <> '') { +if ($viewstatut <> '' && $viewstatut >= 0) { $sql.= " AND e.fk_statut = ".$viewstatut; } if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); @@ -113,6 +113,7 @@ if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1,$offset); +//print $sql; $resql=$db->query($sql); if ($resql) { @@ -225,7 +226,8 @@ if ($resql) if ($conf->livraison_bon->enabled) { $shipment->fetchObjectLinked($shipment->id,$shipment->element); - $receiving=(! empty($shipment->linkedObjects['delivery'][0])?$shipment->linkedObjects['delivery'][0]:''); + $receiving=''; + if (count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']); // Ref print ''; diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 8b7066adc09..f18ed1ea80f 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -37,7 +37,7 @@ print load_fiche_titre($langs->trans('RelatedShippings'), '', ''); trans("Ref"); ?> trans("Date"); ?> trans("DateDeliveryPlanned"); ?> - trans("AmountHTShort"); ?> + trans(""); ?> trans("Status"); ?> @@ -53,10 +53,10 @@ foreach($linkedObjectBlock as $key => $objectlink) date_creation,'day'); ?> date_delivery,'day'); ?> rights->expedition->lire) { + /*if ($user->rights->expedition->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); - } ?> + }*/ ?> getLibStatut(3); ?> ">transnoentitiesnoconv("RemoveLink")); ?> @@ -64,15 +64,17 @@ foreach($linkedObjectBlock as $key => $objectlink) } ?> + + diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index fe775139362..8a58541772a 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -222,7 +222,7 @@ if ($resql) print_liste_field_titre($langs->trans("TotalHT"),$_SERVER["PHP_SELF"],"d.total_ht","",$param,'align="right"',$sortfield,$sortorder); 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($langs->trans("Status"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 03b217f9a91..3e629e05789 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -57,8 +57,6 @@ llxHeader("",$langs->trans("Interventions"),$help_url); print load_fiche_titre($langs->trans("InterventionsArea")); -//print ''; -//print '
'; print '
'; @@ -204,14 +202,13 @@ if (! empty($conf->ficheinter->enabled)) } -//print '
'; print '
'; $max=5; /* - * Last modified orders + * Last modified interventions */ $sql = "SELECT f.rowid, f.ref, f.fk_statut, f.date_valid as datec, f.tms as datem,"; @@ -281,16 +278,17 @@ else dol_print_error($db); /* - * Orders to process + * interventions to process */ -if (! empty($conf->commande->enabled)) +/* +if (! empty($conf->fichinter->enabled)) { $sql = "SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid"; $sql.=" FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND f.entity IN (".getEntity('commande', 1).")"; + $sql.= " AND f.entity IN (".getEntity('fichinter', 1).")"; $sql.= " AND f.fk_statut = 1"; if ($socid) $sql.= " AND f.fk_soc = ".$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; @@ -303,7 +301,7 @@ if (! empty($conf->commande->enabled)) print ''; print ''; - print ''; + print ''; if ($num) { @@ -350,11 +348,10 @@ if (! empty($conf->commande->enabled)) } else dol_print_error($db); } +*/ - -//print '
'.$langs->trans("OrdersToProcess").' '.$num.'
'.$langs->trans("FichinterToProcess").' '.$num.'
'; print '
'; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a72a6f61aa3..ce03c9ba1c8 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -458,6 +458,9 @@ if (empty($reshook)) break; } } + + // Now reload line + $object->fetch_lines(); } else { @@ -1321,7 +1324,6 @@ if ($action == 'create') $datedue=($datetmp==''?-1:$datetmp); } - dol_fiche_head(); print '
'; print ''; @@ -1329,6 +1331,8 @@ if ($action == 'create') print ''; print ''; + dol_fiche_head(); + print ''; // Ref diff --git a/htdocs/index.php b/htdocs/index.php index 8bc704520ca..6058e5a70c8 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -147,8 +147,8 @@ if (empty($user->societe_id)) // Condition to be checked for each display line dashboard $conditions=array( $user->rights->user->user->lire, - ! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), - ! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), + ! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), + ! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS), ! empty($conf->adherent->enabled) && $user->rights->adherent->lire, ! empty($conf->product->enabled) && $user->rights->produit->lire, @@ -157,8 +157,8 @@ if (empty($user->societe_id)) ! empty($conf->commande->enabled) && $user->rights->commande->lire, ! empty($conf->facture->enabled) && $user->rights->facture->lire, ! empty($conf->contrat->enabled) && $user->rights->contrat->activer, - ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire, - ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire, + ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), + ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire); // Class file containing the method load_state_board for each line $includes=array( diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 81c73356c93..ccf22bb5003 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -76,6 +76,7 @@ ProductsCategoryShort=Products tag/category MembersCategoryShort=Members tag/category SuppliersCategoriesShort=Suppliers tags/categories CustomersCategoriesShort=Customers tags/categories +ProspectsCategoriesShort=Prospects tags/categories CustomersProspectsCategoriesShort=Custo./Prosp. categories ProductsCategoriesShort=Products tags/categories MembersCategoriesShort=Members tags/categories diff --git a/htdocs/langs/en_US/deliveries.lang b/htdocs/langs/en_US/deliveries.lang index 4eb1c792b65..eab3826a2c7 100644 --- a/htdocs/langs/en_US/deliveries.lang +++ b/htdocs/langs/en_US/deliveries.lang @@ -17,6 +17,9 @@ DeleteDeliveryReceiptConfirm=Are you sure you want to delete delivery receipt trans("CreateADeliveryOrder")); @@ -538,8 +538,17 @@ else $soc->fetch($object->socid); $head=delivery_prepare_head($object); - dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending'); + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending'); + /* * Confirmation de la suppression * @@ -565,13 +574,6 @@ else * Livraison */ - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; // Shipment @@ -590,7 +592,9 @@ else // Ref print ''; - print ''; + print ''; // Client print ''; @@ -818,15 +822,13 @@ else print "
'.$langs->trans("Ref").''.$object->ref.'
'; + print $object->ref; + print '
'.$langs->trans("Customer").'
\n"; - if($object->statut == 0) // only if draft - print '
'; - + dol_fiche_end(); + + //if ($object->statut == 0) // only if draft + // print '
'; + print ''; - - - - print "\n\n"; - + /* * Boutons actions @@ -899,6 +901,7 @@ else print '
'; + // List of existing shipment and delivery receipts if ($expedition->origin_id) { print '
'; diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index faac4766337..14a83aca2f7 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -65,9 +65,9 @@ class Livraison extends CommonObject $this->products = array(); // List of short language codes for status - $this->statuts[-1] = 'StatusSendingCanceled'; - $this->statuts[0] = 'StatusSendingDraft'; - $this->statuts[1] = 'StatusSendingValidated'; + $this->statuts[-1] = 'StatusDeliveryCanceled'; + $this->statuts[0] = 'StatusDeliveryDraft'; + $this->statuts[1] = 'StatusDeliveryValidated'; } /** @@ -801,9 +801,9 @@ class Livraison extends CommonObject if ($mode==0) { - if ($statut==-1) return $langs->trans('StatusSendingCanceled'); - if ($statut==0) return $langs->trans('StatusSendingDraft'); - if ($statut==1) return $langs->trans('StatusSendingValidated'); + if ($statut==-1) return $langs->trans('StatusDeliveryCanceled'); + if ($statut==0) return $langs->trans('StatusDeliveryDraft'); + if ($statut==1) return $langs->trans('StatusDeliveryValidated'); } if ($mode==1) { @@ -813,9 +813,9 @@ class Livraison extends CommonObject } if ($mode == 4) { - if ($statut==-1) return img_picto($langs->trans('StatusSendingCanceled'),'statut5').' '.$langs->trans('StatusSendingCanceled'); - if ($statut==0) return img_picto($langs->trans('StatusSendingDraft'),'statut0').' '.$langs->trans('StatusSendingDraft'); - if ($statut==1) return img_picto($langs->trans('StatusSendingValidated'),'statut4').' '.$langs->trans('StatusSendingValidated'); + if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'),'statut5').' '.$langs->trans('StatusDeliveryCanceled'); + if ($statut==0) return img_picto($langs->trans('StatusDeliveryDraft'),'statut0').' '.$langs->trans('StatusDeliveryDraft'); + if ($statut==1) return img_picto($langs->trans('StatusDeliveryValidated'),'statut4').' '.$langs->trans('StatusDeliveryValidated'); } } diff --git a/htdocs/opensurvey/wizard/index.php b/htdocs/opensurvey/wizard/index.php index 68f75f3bce7..0fdde4bbe40 100644 --- a/htdocs/opensurvey/wizard/index.php +++ b/htdocs/opensurvey/wizard/index.php @@ -1,6 +1,7 @@ - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2013 Laurent Destailleur + * Copyright (C) 2014 Marcos García + * Copyright (C) 2016 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +23,7 @@ //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index d82adceb1a4..97283b4b2bc 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -230,7 +230,8 @@ else else $sql.= " AND p.fk_product_type <> '1'"; } if ($sref) $sql .= natural_search('p.ref', $sref); - if ($sbarcode) $sql .= natural_search('p.barcode', $sbarcode); + if ($snom) $sql .= natural_search('p.label', $snom); + if ($sbarcode) $sql .= natural_search('p.barcode', $sbarcode); if (isset($tosell) && dol_strlen($tosell) > 0 && $tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($tosell); if (isset($tobuy) && dol_strlen($tobuy) > 0 && $tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($tobuy); if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 4801dff3af0..6d487de21e3 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -68,7 +68,7 @@ $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"; +$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; $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"; @@ -83,6 +83,16 @@ $result=$db->query($sql); if ($result) { $totalnboflines = $db->num_rows($result); + // fetch totals + $line = $total = $totalsell = $totalStock = 0; + while ($line < $totalnboflines) + { + $objp = $db->fetch_object($result); + $total += price2num($objp->estimatedvalue,'MU'); + $totalsell += price2num($objp->sellvalue,'MU'); + $totalStock += $objp->stockqty; + $line++; + } } $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -118,6 +128,7 @@ if ($result) print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stockqty",'','','align="right"',$sortfield,$sortorder); 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); @@ -135,7 +146,7 @@ if ($result) print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -152,7 +163,6 @@ if ($result) if ($num) { $entrepot=new Entrepot($db); - $total = $totalsell = 0; $var=false; while ($i < min($num,$limit)) { @@ -164,6 +174,8 @@ if ($result) print '' . $entrepot->getNomUrl(1) . ''; // Location print ''.$objp->lieu.''; + // Stock qty + print ''.price2num($objp->stockqty,5).''; // PMP value print ''; if (price2num($objp->estimatedvalue,'MT')) print price(price2num($objp->estimatedvalue,'MT'),1); @@ -185,17 +197,15 @@ if ($result) print "\n"; - $total += price2num($objp->estimatedvalue,'MU'); - $totalsell += price2num($objp->sellvalue,'MU'); - $var=!$var; $i++; } - if ($totalnboflines <= $limit) + if ($totalnboflines-$offset <= $limit) { print ''; print ''.$langs->trans("Total").''; + print ''.price2num($totalStock,5).''; print ''.price(price2num($total,'MT'),1,$langs,0,0,-1,$conf->currency).''; print ''; if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell,'MT'),1,$langs,0,0,-1,$conf->currency); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 4376811142b..cc31d1090f8 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -316,7 +316,7 @@ $startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['fi for($i=0;$i<7;$i++) { - print ''.dol_print_date($startday + ($i * 3600 * 24), '%a').'
'.dol_print_date($startday + ($i * 3600 * 24), 'day').''; + print ''.dol_print_date($startday + ($i * 3600 * 24), '%a').'
'.dol_print_date($startday + ($i * 3600 * 24), 'dayreduceformat').''; } print ''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index aca5fe67d0d..7548f4f2e0a 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -894,7 +894,14 @@ class Project extends CommonObject if (preg_match('/\.php$/',$option)) { $link = ''; + } + else + { $link = 'liste_limit; +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield='p.ref'; +if (! $sortorder) $sortorder='DESC'; + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $contextpage='projectlist'; @@ -115,11 +126,11 @@ $arrayfields=array( 'p.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), 'p.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101), 'p.public'=>array('label'=>$langs->trans("Visibility"), 'checked'=>1, 'position'=>102), - 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmount"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>103), - 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatus"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>104), - 'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>103), + 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>104), + 'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - 'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -150,12 +161,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_public=""; $search_sale=""; $search_user=''; - $day=""; - $month=""; - $year=""; $sday=""; $smonth=""; $syear=""; + $day=""; + $month=""; + $year=""; $search_array_options=array(); } @@ -171,12 +182,32 @@ $form = new Form($db); $formother = new FormOther($db); $formproject = new FormProjets($db); -llxHeader("",$langs->trans("Projects"),"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"); +$title=$langs->trans("Projects"); +if ($search_user == $user->id) $title=$langs->trans("MyProjects"); +llxHeader("",$title,"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"); -$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$mine:($user->rights->projet->all->lire?2:0)),1,$socid); +// Get list of project id allowed to user (in a string list separated by coma) +if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid); -$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat"; +// Get id of types of contacts for projects (This list never contains a lot of elements) +$listofprojectcontacttype=array(); +$sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc"; +$sql.= " WHERE ctc.element = '" . $projectstatic->element . "'"; +$sql.= " AND ctc.source = 'internal'"; +$resql = $db->query($sql); +if ($resql) +{ + while($obj = $db->fetch_object($resql)) + { + $listofprojectcontacttype[$obj->rowid]=$obj->code; + } +} +else dol_print_error($db); +if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid sql syntax error if not found + +$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. +$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat"; $sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.tms as date_update"; $sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", cls.code as opp_status_code"; @@ -194,14 +225,12 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = c if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; if ($search_user > 0) { - $sql.=", ".MAIN_DB_PREFIX."element_contact as c"; - $sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc"; + $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; } -$sql.= " WHERE p.entity = ".$conf->entity; -if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; +$sql.= " WHERE p.entity IN (".getEntity('project').')'; +if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser -//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_label) $sql .= natural_search('p.title', $search_label); @@ -209,15 +238,15 @@ if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($smonth > 0) { if ($syear > 0 && empty($sday)) - $sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($syear,$smonth,false))."' AND '".$db->idate(dol_get_last_day($syear,$smonth,false))."'"; + $sql.= " AND p.dateo BETWEEN '".$db->idate(dol_get_first_day($syear,$smonth,false))."' AND '".$db->idate(dol_get_last_day($syear,$smonth,false))."'"; else if ($syear > 0 && ! empty($sday)) - $sql.= " AND p.datee BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'"; + $sql.= " AND p.dateo BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'"; else - $sql.= " AND date_format(p.datee, '%m') = '".$smonth."'"; + $sql.= " AND date_format(p.dateo, '%m') = '".$smonth."'"; } else if ($syear > 0) { - $sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($syear,1,false))."' AND '".$db->idate(dol_get_last_day($syear,12,false))."'"; + $sql.= " AND p.dateo BETWEEN '".$db->idate(dol_get_first_day($syear,1,false))."' AND '".$db->idate(dol_get_last_day($syear,12,false))."'"; } if ($month > 0) { @@ -243,26 +272,36 @@ if ($search_opp_status) if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; -if ($search_user > 0) $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='project' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user; +if ($search_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_user; // Add where from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; - $sql.= $db->order($sortfield,$sortorder); -$sql.= $db->plimit($conf->liste_limit+1, $offset); -//print $sql; + +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit + 1,$offset); + dol_syslog("list allowed project", LOG_DEBUG); +//print $sql; $resql = $db->query($sql); if ($resql) { $var=true; $num = $db->num_rows($resql); - $i = 0; $param=''; - //if ($mine) $param.='&mode=mine'; + if ($sday) $param.='&sday='.$day; + if ($smonth) $param.='&smonth='.$smonth; + if ($syear) $param.='&syear=' .$syear; + if ($day) $param.='&day='.$day; if ($month) $param.='&month='.$month; if ($year) $param.='&year=' .$year; if ($socid) $param.='&socid='.$socid; @@ -311,12 +350,6 @@ if ($resql) print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); } - - $colspan=8; - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $colspan+=2; - if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE)) $colspan++; - - // If the user can view thirdparties other than his' if ($user->rights->societe->client->voir || $socid) { @@ -327,7 +360,7 @@ if ($resql) $moreforfilter.=''; } - // If the user can view prospects other than his' + // If the user can view user other than himself $moreforfilter.='
'; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; $includeonly=''; @@ -351,15 +384,15 @@ if ($resql) print ''; print ''; - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['commercial']['checked'])) print_liste_field_titre($langs->trans("SalesRepresentative"),$_SERVER["PHP_SELF"],"","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.dateo']['checked'])) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"p.dateo","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.datee']['checked'])) print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"p.datee","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.public']['checked'])) print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($langs->trans("OpportunityAmountShort"),$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($langs->trans("OpportunityStatusShort"),$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'],$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['commercial']['checked'])) print_liste_field_titre($arrayfields['commercial']['label'],$_SERVER["PHP_SELF"],"","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.dateo']['checked'])) print_liste_field_titre($arrayfields['p.dateo']['label'],$_SERVER["PHP_SELF"],"p.dateo","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.datee']['checked'])) print_liste_field_titre($arrayfields['p.datee']['label'],$_SERVER["PHP_SELF"],"p.datee","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.public']['checked'])) print_liste_field_titre($arrayfields['p.public']['label'],$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'],$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'],$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'align="center"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -376,9 +409,9 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -466,7 +499,7 @@ if ($resql) print ''; } - if (! empty($arrayfields['p.statut']['checked'])) + if (! empty($arrayfields['p.fk_statut']['checked'])) { print ''."\n"; - - while ($i < $num) + $i = 0; + while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); $projectstatic->id = $obj->projectid; $projectstatic->user_author_id = $obj->fk_user_creat; $projectstatic->public = $obj->public; - - $userAccess = $projectstatic->restrictedProjectArea($user); - + $projectstatic->ref = $obj->ref; + + $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? if ($userAccess >= 0) { $var=!$var; @@ -500,7 +533,6 @@ if ($resql) if (! empty($arrayfields['p.ref']['checked'])) { print ''; } @@ -636,7 +668,7 @@ if ($resql) print ''; } // Status - if (! empty($arrayfields['p.statut']['checked'])) + if (! empty($arrayfields['p.fk_statut']['checked'])) { $projectstatic->statut = $obj->fk_statut; print ''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index d23617192b3..e140ee2f672 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -28,60 +28,128 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load('projects'); $langs->load('users'); +$langs->load('companies'); $id=GETPOST('id','int'); $search_all=GETPOST('search_all'); $search_project=GETPOST('search_project'); -if (! isset($_GET['search_status']) && ! isset($_POST['search_status'])) $search_status=1; -else $search_status=GETPOST('search_status'); +if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) $search_projectstatus=1; +else $search_projectstatus=GETPOST('search_projectstatus'); +$search_project_ref=GETPOST('search_project_ref'); +$search_project_title=GETPOST('search_project_title'); $search_task_ref=GETPOST('search_task_ref'); $search_task_label=GETPOST('search_task_label'); +$search_task_description=GETPOST('search_task_description'); $search_project_user=GETPOST('search_project_user'); $search_task_user=GETPOST('search_task_user'); $mine = $_REQUEST['mode']=='mine' ? 1 : 0; -if ($mine) $search_task_user = $user->id; +if ($mine) { $search_task_user = $user->id; $mine = 0; } + +$sday = GETPOST('sday','int'); +$smonth = GETPOST('smonth','int'); +$syear = GETPOST('syear','int'); +$day = GETPOST('day','int'); +$month = GETPOST('month','int'); +$year = GETPOST('year','int'); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$contextpage='tasklist'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array($contextpage)); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('project'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // Security check $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; if (!$user->rights->projet->lire) accessforbidden(); -$sortfield = GETPOST("sortfield"); -$sortorder = GETPOST("sortorder"); -$page = GETPOST("page"); -$page = is_numeric($page) ? $page : 0; -$page = $page == -1 ? 0 : $page; - -// Purge criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $search_all=""; - $search_project=""; - $search_status=""; - $search_task_ref=""; - $search_task_label=""; - $search_task_user=-1; - $search_project_user=-1; -} -if (empty($search_status) && $search_status == '') $search_status=1; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield='p.ref'; +if (! $sortorder) $sortorder='DESC'; // List of fields to search into when doing a "search in all" $fieldstosearchall = array( 't.ref'=>"Ref", - 't.label'=>"Label", + 't.label'=>"Label", + 't.description'=>"Description", + 't.note_public'=>"NotePublic", ); +if (empty($user->socid)) $fieldstosearchall['t.note_private']="NotePrivate"; + +$arrayfields=array( + 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1), + 'p.title'=>array('label'=>$langs->trans("ProjectLabel"), 'checked'=>0), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>0), + 'p.fk_statut'=>array('label'=>$langs->trans("ProjectStatus"), 'checked'=>1), + 't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>80), + 't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>80), + 't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), + 't.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101), + 't.planned_workload'=>array('label'=>$langs->trans("PlannedWorkload"), 'checked'=>1, 'position'=>102), + 't.duration_effective'=>array('label'=>$langs->trans("TimeSpent"), 'checked'=>1, 'position'=>103), + 't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>104), + 't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>105), + 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + //'t.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), +); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } +} /* * Actions */ -// None +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +// Purge criteria +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_all=""; + $search_project=""; + $search_projectstatus=-1; + $search_project_ref=""; + $search_project_title=""; + $search_task_ref=""; + $search_task_label=""; + $search_task_description=""; + $search_task_user=-1; + $search_project_user=-1; + $sday=''; + $smonth=''; + $syear=''; + $day=''; + $month=''; + $year=''; +} +if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1; + + /* @@ -89,6 +157,8 @@ $fieldstosearchall = array( */ $form=new Form($db); +$formother=new FormOther($db); +$socstatic=new Societe($db); $projectstatic = new Project($db); $taskstatic = new Task($db); $puser=new User($db); @@ -97,7 +167,7 @@ if ($search_project_user > 0) $puser->fetch($search_project_user); if ($search_task_user > 0) $tuser->fetch($search_task_user); $title=$langs->trans("Activities"); -if ($mine) $title=$langs->trans("MyActivities"); +if ($search_task_user == $user->id) $title=$langs->trans("MyActivities"); llxHeader("",$title,"Projet"); @@ -107,143 +177,546 @@ if ($id) $projectstatic->societe->fetch($projectstatic->societe->id); } -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project'); - -// Show description of content -if ($mine) print $langs->trans("MyTasksDesc").'

'; -else -{ - if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'

'; - else print $langs->trans("ProjectsPublicDesc").'

'; -} - // Get list of project id allowed to user (in a string list separated by coma) -$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid); +if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid); //var_dump($projectsListId); -// Get list of tasks in tasksarray and taskarrayfiltered -// We need all tasks (even not limited to a user because a task assigned to a user can have a parent that is not assigned to him and we need such parents). -$morewherefilter=''; -if ($search_all) $morewherefilter.=natural_search(array_keys($fieldstosearchall), $search_all); -if ($search_task_ref) $morewherefilter.=natural_search('t.ref', $search_task_ref); -if ($search_task_label) $morewherefilter.=natural_search('t.label', $search_task_label); - -$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project, $search_status, $morewherefilter, $search_project_user, 0); // We don't use filter on task user. Because sometimes a task is assigned but not the parent one and we want to show also parent, so filtering is done during output -$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, ($tuser->id?$tuser:null), $projectstatic->id, 0, $search_status); // We load also tasks limited to a particular user - -print ''; -if ($optioncss != '') print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -if ($search_all) +// Get id of types of contacts for projects (This list never contains a lot of elements) +$listofprojectcontacttype=array(); +$sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc"; +$sql.= " WHERE ctc.element = '" . $projectstatic->element . "'"; +$sql.= " AND ctc.source = 'internal'"; +$resql = $db->query($sql); +if ($resql) { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall)); + while($obj = $db->fetch_object($resql)) + { + $listofprojectcontacttype[$obj->rowid]=$obj->code; + } +} +else dol_print_error($db); +if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid sql syntax error if not found +// Get id of types of contacts for tasks (This list never contains a lot of elements) +$listoftaskcontacttype=array(); +$sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc"; +$sql.= " WHERE ctc.element = '" . $taskstatic->element . "'"; +$sql.= " AND ctc.source = 'internal'"; +$resql = $db->query($sql); +if ($resql) +{ + while($obj = $db->fetch_object($resql)) + { + $listoftaskcontacttype[$obj->rowid]=$obj->code; + } +} +else dol_print_error($db); +if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found + +$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. +$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate"; +$sql.= ", s.nom as name, s.rowid as socid"; +$sql.= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update"; +$sql.= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut"; +// Add fields for extrafields +foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid,"; +$sql.= " ".MAIN_DB_PREFIX."projet_task as t"; +if ($search_project_user > 0) +{ + $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; +} +if ($search_task_user > 0) +{ + $sql.=", ".MAIN_DB_PREFIX."element_contact as ect"; +} +$sql.= " WHERE t.fk_projet = p.rowid"; +$sql.= " AND p.entity IN (".getEntity('project').')'; +if (! $user->rights->projet->all->lire) $sql.=" p.rowid IN (".join(',',$projectsListId).")"; // public and assigned to projects, or restricted to company for external users +// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser +if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; +if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); +if ($search_project_title) $sql .= natural_search('p.title', $search_project_title); +if ($search_task_ref) $sql .= natural_search('t.ref', $search_task_ref); +if ($search_task_label) $sql .= natural_search('t.label', $search_task_label); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($smonth > 0) +{ + if ($syear > 0 && empty($sday)) + $sql.= " AND t.dateo BETWEEN '".$db->idate(dol_get_first_day($syear,$smonth,false))."' AND '".$db->idate(dol_get_last_day($syear,$smonth,false))."'"; + else if ($syear > 0 && ! empty($sday)) + $sql.= " AND t.dateo BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'"; + else + $sql.= " AND date_format(t.dateo, '%m') = '".$smonth."'"; +} +else if ($syear > 0) +{ + $sql.= " AND t.dateo BETWEEN '".$db->idate(dol_get_first_day($syear,1,false))."' AND '".$db->idate(dol_get_last_day($syear,12,false))."'"; +} +if ($month > 0) +{ + if ($year > 0 && empty($day)) + $sql.= " AND t.datee BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; + else if ($year > 0 && ! empty($day)) + $sql.= " AND t.datee BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; + else + $sql.= " AND date_format(t.datee, '%m') = '".$month."'"; +} +else if ($year > 0) +{ + $sql.= " AND t.datee BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; +} +if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); +if ($search_projectstatus >= 0) $sql .= " AND p.fk_statut = ".$db->escape($search_projectstatus); +if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); +if ($search_project_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_project_user; +if ($search_task_user > 0) $sql.= " AND ect.fk_c_type_contact IN (".join(',',array_keys($listoftaskcontacttype)).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".$search_task_user; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= $db->order($sortfield,$sortorder); + +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); } +$sql.= $db->plimit($limit + 1,$offset); -// If the user can view users -//if ($mine) $search_project_user=$user->id; // We want by default all project. "mine" is a filter for task contact on this page -$moreforfilter.='
'; -$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ' '; -$includeonly=''; -if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); -$moreforfilter.=$form->select_dolusers($search_project_user, 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); -$moreforfilter.='
'; -// If the user can view users -$moreforfilter.='
'; -$moreforfilter.=$langs->trans('TasksWithThisUserAsContact'). ': '; -$includeonly=''; -if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); -$moreforfilter.=$form->select_dolusers($search_task_user, 'search_task_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); -$moreforfilter.='
'; - -if (! empty($moreforfilter)) +dol_syslog("list allowed project", LOG_DEBUG); +//print $sql; +$resql = $db->query($sql); +if ($resql) { - print '
'; - print $moreforfilter; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + $var=true; + $num = $db->num_rows($resql); + + $param=''; + if ($sday) $param.='&sday='.$day; + if ($smonth) $param.='&smonth='.$smonth; + if ($syear) $param.='&syear=' .$syear; + if ($day) $param.='&day='.$day; + if ($month) $param.='&month='.$month; + if ($year) $param.='&year=' .$year; + if ($socid) $param.='&socid='.$socid; + if ($search_all != '') $param.='&search_all='.$search_all; + if ($search_project_ref != '') $param.='&search_project_ref='.$search_project_ref; + if ($search_project_title != '') $param.='&search_project_title='.$search_project_title; + if ($search_ref != '') $param.='&search_ref='.$search_ref; + if ($search_label != '') $param.='&search_label='.$search_label; + if ($search_societe != '') $param.='&search_societe='.$search_societe; + if ($search_projectstatus != '') $param.='&search_projectstatus='.$search_projectstatus; + if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); + if ($search_public != '') $param.='&search_public='.$search_public; + if ($search_project_user > 0) $param.='&search_project_user='.$search_project_user; + if ($search_task_user > 0) $param.='&search_task_user='.$search_task_user; + if ($optioncss != '') $param.='&optioncss='.$optioncss; + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project'); + + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + // Show description of content + if ($search_task_user == $user->id) print $langs->trans("MyTasksDesc").'

'; + else + { + if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'

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

'; + } + + if ($search_all) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); + } + + // If the user can view users + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ' '; + $includeonly=''; + if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); + $moreforfilter.=$form->select_dolusers($search_project_user, 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); + $moreforfilter.='
'; + + // If the user can view users + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('TasksWithThisUserAsContact'). ': '; + $includeonly=''; + if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); + $moreforfilter.=$form->select_dolusers($search_task_user, 'search_task_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); + $moreforfilter.='
'; + + if (! empty($moreforfilter)) + { + print '
'; + print $moreforfilter; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; + } + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print '
'; print ''; print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('Draft'),'1'=>$langs->trans('Opened'),'2'=>$langs->trans('Closed')),$search_status); @@ -480,17 +513,17 @@ if ($resql) print '
'; - $projectstatic->ref = $obj->ref; print $projectstatic->getNomUrl(1); print ''.$projectstatic->getLibStatut(5).'
'; + + print ''; + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'],$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'],$_SERVER["PHP_SELF"],"t.label","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'],$_SERVER["PHP_SELF"],"t.dateo","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'],$_SERVER["PHP_SELF"],"t.datee","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'],$_SERVER["PHP_SELF"],"t.planned_workload","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'],$_SERVER["PHP_SELF"],"t.duration_effective","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'],$_SERVER["PHP_SELF"],"","",$param,'align="center"'); + if (! empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'],$_SERVER["PHP_SELF"],"t.progress","",$param,'align="center"',$sortfield,$sortorder); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } + } + // Hook fields + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print ''; -} + if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; + print ''; + if (! empty($arrayfields['p.ref']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.title']['checked'])) + { + print ''; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.fk_statut']['checked'])) + { + print ''; + } + if (! empty($arrayfields['t.ref']['checked'])) + { + print ''; + } + if (! empty($arrayfields['t.label']['checked'])) + { + print ''; + } + // Start date + if (! empty($arrayfields['t.dateo']['checked'])) + { + print ''; + } + // End date + if (! empty($arrayfields['t.datee']['checked'])) + { + print ''; + } + if (! empty($arrayfields['t.planned_workload']['checked'])) print ''; + if (! empty($arrayfields['t.duration_effective']['checked'])) print ''; + if (! empty($arrayfields['t.progress_calculated']['checked'])) print ''; + if (! empty($arrayfields['t.progress']['checked'])) print ''; + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) print ''; + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['t.datec']['checked'])) + { + // Date creation + print ''; + } + if (! empty($arrayfields['t.tms']['checked'])) + { + // Date modification + print ''; + } + // Action column + print ''; + print ''; + + + $i = 0; + while ($i < min($num,$limit)) + { + $obj = $db->fetch_object($resql); -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; + $projectstatic->id = $obj->projectid; + $projectstatic->ref = $obj->projectref; + $projectstatic->title = $obj->projecttitle; + $projectstatic->public = $obj->public; + $projectstatic->statut = $obj->projectstatus; + + $taskstatic->id = $obj->id; + $taskstatic->ref = $obj->ref; + $taskstatic->label = $obj->label; + $taskstatic->fk_statut = $obj->fk_statut; + $taskstatic->progress = $obj->progress; + + $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? + if ($userAccess >= 0) + { + $var=!$var; + print ""; -$max=10000; + // Project url + if (! empty($arrayfields['p.ref']['checked'])) + { + print ''; + } + // Title + if (! empty($arrayfields['p.title']['checked'])) + { + print ''; + } + // Company + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + } + // Status + if (! empty($arrayfields['p.fk_statut']['checked'])) + { + print ''; + } + // Ref + if (! empty($arrayfields['t.ref']['checked'])) + { + print ''; + } + // Label + if (! empty($arrayfields['t.label']['checked'])) + { + print ''; + } + // Date start + if (! empty($arrayfields['t.dateo']['checked'])) + { + print ''; + } + // Date end + if (! empty($arrayfields['t.datee']['checked'])) + { + print ''; + } + + $plannedworkloadoutputformat='allhourmin'; + $timespentoutputformat='allhourmin'; + if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; + if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; + + // Planned workload + if (! empty($arrayfields['t.planned_workload']['checked'])) + { + print ''; + } + // Time spent + if (! empty($arrayfields['t.duration_effective']['checked'])) + { + $showlineingray=0;$showproject=1; + print ''; + } + // Calculated progress + if (! empty($arrayfields['t.progress_calculated']['checked'])) + { + print ''; + } + // Declared progress + if (! empty($arrayfields['t.progress']['checked'])) + { + print ''; + } + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['t.datec']['checked'])) + { + print ''; + } + // Date modification + if (! empty($arrayfields['t.tms']['checked'])) + { + print ''; + } + // Status + /*if (! empty($arrayfields['p.fk_statut']['checked'])) + { + $projectstatic->statut = $obj->fk_statut; + print ''; + }*/ + // Action column + print ''; -if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?$max:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) -{ - $langs->load("errors"); - print ''; - print ''; + print "\n"; + + //print projectLinesa(); + } + + $i++; + } + $db->free($resql); + + $parameters=array('sql' => $sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print "
'.$langs->trans("Project").''.$langs->trans("ProjectStatus").''.$langs->trans("RefTask").''.$langs->trans("LabelTask").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("PlannedWorkload"); -// TODO Replace 86400 and 7 to take account working hours per day and working day per weeks -//print '
('.$langs->trans("DelayWorkHour").')'; -print '
'.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("ProgressCalculated").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $listofstatus=array(-1=>' '); + foreach($projectstatic->statuts_short as $key => $val) $listofstatus[$key]=$langs->trans($val); + print $form->selectarray('search_projectstatus', $listofstatus, $search_projectstatus); + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($syear?$syear:-1,'syear',1, 20, 5); + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($year?$year:-1,'year',1, 20, 5); + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; -print ''; -print ''; -$listofstatus=array(-1=>' '); -foreach($projectstatic->statuts_short as $key => $val) $listofstatus[$key]=$langs->trans($val); -print $form->selectarray('search_status', $listofstatus, $search_status); -print ''; -print ''; -print ''; -print ''; -print ''; -print ' '; -print ''; -print ''; -print ''; -print '
'; + print $projectstatic->getNomUrl(1, 'task'); + print ''; + print dol_trunc($obj->projecttitle,80); + print ''; + if ($obj->socid) + { + $socstatic->id=$obj->socid; + $socstatic->name=$obj->name; + print $socstatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; + print $projectstatic->getLibStatut(1); + print ''; + print $taskstatic->getNomUrl(1,'withproject'); + print ''; + print $taskstatic->label; + print ''; + print dol_print_date($db->jdate($obj->date_start),'day'); + print ''; + print dol_print_date($db->jdate($obj->date_end),'day'); + print ''; + $fullhour=convertSecondToTime($obj->planned_workload,$plannedworkloadoutputformat); + $workingdelay=convertSecondToTime($obj->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks + if ($obj->planned_workload != '') + { + print $fullhour; + // TODO Add delay taking account of working hours per day and working day per week + //if ($workingdelay != $fullhour) print '
('.$workingdelay.')'; + } + //else print '--:--'; + print '
'; + if ($showlineingray) print ''; + else print ''; + if ($obj->duration_effective) print convertSecondToTime($obj->duration_effective,$timespentoutputformat); + else print '--:--'; + if ($showlineingray) print ''; + else print ''; + print ''; + if ($obj->planned_workload || $obj->duration_effective) + { + if ($obj->planned_workload) print round(100 * $obj->duration_effective / $obj->planned_workload,2).' %'; + else print $langs->trans('WorkloadNotDefined'); + } + print ''; + if ($obj->progress != '') + { + print $obj->progress.' %'; + } + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''.$projectstatic->getLibStatut(5).'
'; - print $langs->trans("WarningTooManyDataPleaseUseMoreFilters", $max, 'PROJECT_LIMIT_TASK_PROJECT_AREA'); - print '
"; + + print ''; } else { - // Show all lines in taskarray (recursive function to go down on tree) - $j=0; $level=0; - //var_dump($tasksarray); - $nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 1, $tasksrole, $projectsListId, 0); -} - -print ""; - -print ''; - -print '
'; - -/* - * Actions - */ -if ($user->rights->projet->creer) -{ - print '
'; + dol_print_error($db); } diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index b5f895cdcbb..615ee04cd44 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Charles-Fr Benke * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -115,9 +116,9 @@ if ($result) while ($objp = $db->fetch_object($result)) { $found=0; - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found=1; $third['customer']++; } - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found=1; $third['prospect']++; } - if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found=1; $third['supplier']++; } + if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found=1; $third['prospect']++; } + if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found=1; $third['customer']++; } + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found=1; $third['supplier']++; } if (! empty($conf->societe->enabled) && $objp->client == 0 && $objp->fournisseur == 0) { $found=1; $third['other']++; } if ($found) $total++; } @@ -130,9 +131,9 @@ if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(rou { print ''; $dataseries=array(); - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array('label'=>$langs->trans("Prospects"),'data'=>round($third['prospect'])); - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Customers"),'data'=>round($third['customer'])); - if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Suppliers"),'data'=>round($third['supplier'])); + if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array('label'=>$langs->trans("Prospects"),'data'=>round($third['prospect'])); + if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Customers"),'data'=>round($third['customer'])); + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Suppliers"),'data'=>round($third['supplier'])); if (! empty($conf->societe->enabled)) $dataseries[]=array('label'=>$langs->trans("Others"),'data'=>round($third['other'])); $data=array('series'=>$dataseries); dol_print_graph('stats',300,180,$data,1,'pie',0,'',0); @@ -140,19 +141,19 @@ if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(rou } else { - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) + if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) { $statstring = ""; $statstring.= ''.$langs->trans("Prospects").''.round($third['prospect']).''; $statstring.= ""; } - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) + if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) { $statstring.= ""; $statstring.= ''.$langs->trans("Customers").''.round($third['customer']).''; $statstring.= ""; } - if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) + if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire) { $statstring2 = ""; $statstring2.= ''.$langs->trans("Suppliers").''.round($third['supplier']).'';