From 4ebd1ff8a2c5fe1452e42866cff9b6d5d65cdd34 Mon Sep 17 00:00:00 2001 From: Benlo Date: Wed, 12 Oct 2016 12:30:22 +0200 Subject: [PATCH 01/56] Permit to print Total TTC price in objectline --- htdocs/core/class/commonobject.class.php | 4 +++- htdocs/core/tpl/objectline_view.tpl.php | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 htdocs/core/tpl/objectline_view.tpl.php diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a82a4c9e537..a09253e02ea 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3277,7 +3277,7 @@ abstract class CommonObject { global $conf, $hookmanager, $langs, $user; // TODO We should not use global var for this ! - global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove; + global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $inputalsopricetotalwithtax; // Define usemargins $usemargins=0; @@ -3340,6 +3340,8 @@ abstract class CommonObject // Multicurrency if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('TotalHTShortCurrency').''; + if ($inputalsopricetotalwithtax) print ''.$langs->trans('TotalTTCShort').''; + print ''; // No width to allow autodim print ''; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php old mode 100644 new mode 100755 index 559cae91464..acdc33db3f1 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -36,7 +36,7 @@ * $type, $text, $description, $line */ -global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins; +global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins, $inputalsopricetotalwithtax; $usemargins=0; if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; @@ -45,6 +45,7 @@ if (empty($dateSelector)) $dateSelector=0; if (empty($forceall)) $forceall=0; if (empty($senderissupplier)) $senderissupplier=0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; +if (empty($inputalsopricetotalwithtax)) $inputalsopricetotalwithtax=0; if (empty($usemargins)) $usemargins=0; ?> @@ -201,6 +202,10 @@ if (empty($usemargins)) $usemargins=0; multicurrency_total_ht); ?> + + total_ttc); ?> + + statut == 0 && ($object_rights->creer)) { ?> From a46e7d8e1abc9cbdb753d2b45081b2a45945c572 Mon Sep 17 00:00:00 2001 From: Benoit Date: Mon, 24 Oct 2016 10:18:24 +0200 Subject: [PATCH 02/56] Change inputalsopricetotalwithtax to outputalsopricetotalwithtax --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/tpl/objectline_view.tpl.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a09253e02ea..824c9b032ad 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3277,7 +3277,7 @@ abstract class CommonObject { global $conf, $hookmanager, $langs, $user; // TODO We should not use global var for this ! - global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $inputalsopricetotalwithtax; + global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $outputalsopricetotalwithtax; // Define usemargins $usemargins=0; @@ -3340,7 +3340,7 @@ abstract class CommonObject // Multicurrency if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('TotalHTShortCurrency').''; - if ($inputalsopricetotalwithtax) print ''.$langs->trans('TotalTTCShort').''; + if ($outputalsopricetotalwithtax) print ''.$langs->trans('TotalTTCShort').''; print ''; // No width to allow autodim diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index acdc33db3f1..4df9eb517b1 100755 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -36,7 +36,7 @@ * $type, $text, $description, $line */ -global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins, $inputalsopricetotalwithtax; +global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins, $outputalsopricetotalwithtax; $usemargins=0; if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; @@ -45,7 +45,7 @@ if (empty($dateSelector)) $dateSelector=0; if (empty($forceall)) $forceall=0; if (empty($senderissupplier)) $senderissupplier=0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; -if (empty($inputalsopricetotalwithtax)) $inputalsopricetotalwithtax=0; +if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; if (empty($usemargins)) $usemargins=0; ?> @@ -202,7 +202,7 @@ if (empty($usemargins)) $usemargins=0; multicurrency_total_ht); ?> - + total_ttc); ?> From 6f061fc3667ad8d4e74735d6a28a9bc86aea6607 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Oct 2016 21:53:39 +0100 Subject: [PATCH 03/56] Fix css --- htdocs/societe/notify/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index a1f38f0562a..9da1d057558 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -172,7 +172,7 @@ if ($result > 0) if ($object->client) { - print ''; + print ''; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -181,14 +181,14 @@ if ($result > 0) if ($object->fournisseur) { - print ''; + print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print ''; } - print ''.$langs->trans("NbOfActiveNotifications").''; + print ''.$langs->trans("NbOfActiveNotifications").''; print ''; $notify=new Notify($db); $tmparray = $notify->getNotificationsArray('', $object->id); From 7be49e47b81dc5e75393b8349f6929458ec1610e Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 1 Nov 2016 17:09:51 +0100 Subject: [PATCH 04/56] indenting and little refactoring --- .../expedition/doc/pdf_rouget.modules.php | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 7420e347482..ece59790fc3 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -790,7 +790,7 @@ class pdf_rouget extends ModelePdfExpedition // Show Draft Watermark if($object->statut==0 && (! empty($conf->global->SHIPPING_DRAFT_WATERMARK)) ) { - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->SHIPPING_DRAFT_WATERMARK); + pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->SHIPPING_DRAFT_WATERMARK); } //Prepare la suite @@ -861,11 +861,11 @@ class pdf_rouget extends ModelePdfExpedition $pdf->SetTextColor(0,0,60); $title=$outputlangs->transnoentities("SendingSheet"); $pdf->MultiCell($w, 4, $title, '', 'R'); - $posy+=1; $pdf->SetFont('','', $default_font_size + 1); - $posy+=4; + $posy+=5; + $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSending") ." : ".$object->ref, '', 'R'); @@ -873,10 +873,10 @@ class pdf_rouget extends ModelePdfExpedition // Date planned delivery if (! empty($object->date_delivery)) { - $posy+=4; - $pdf->SetXY($posx,$posy); - $pdf->SetTextColor(0,0,60); - $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R'); + $posy+=4; + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R'); } if (! empty($object->thirdparty->code_client)) @@ -889,11 +889,10 @@ class pdf_rouget extends ModelePdfExpedition $pdf->SetFont('','', $default_font_size + 3); - $Yoff=25; + $Yoff=25; - // Add list of linked orders - - $origin = $object->origin; + // Add list of linked orders + $origin = $object->origin; $origin_id = $object->origin_id; // TODO move to external function From 73b5bad2da5e6a7f7cd2fe8626258931dcb13b0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Nov 2016 20:53:05 +0100 Subject: [PATCH 05/56] Fix missing hook init --- htdocs/societe/rib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 39069d1e3f5..d16a17c6cab 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -49,11 +49,19 @@ $id=GETPOST("id","int"); $ribid=GETPOST("ribid","int"); $action=GETPOST("action"); +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('thirdpartybancard')); + + /* * Actions */ +$parameters=array('id'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if ($action == 'update' && ! $_POST["cancel"]) { // Modification From 019125f258f09c16c838c5889d38b2c231ee920b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2016 10:29:14 +0100 Subject: [PATCH 06/56] Uniformize code --- htdocs/commande/class/commande.class.php | 8 +- htdocs/expedition/class/expedition.class.php | 23 ++++-- htdocs/expedition/index.php | 77 ++++++++++++-------- 3 files changed, 67 insertions(+), 41 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 249646a8f54..0ae5ab4b217 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3367,12 +3367,8 @@ class Commande extends CommonOrder if ($user->rights->commande->lire) { $label = ''.$langs->trans("ShowOrder").''; - if (!empty($this->ref)) { - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - } - if (!empty($this->ref_client)) { - $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - } + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); if (!empty($this->total_ht)) { $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index c5d84836f90..9cf00cac1cb 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1461,27 +1461,40 @@ class Expedition extends CommonObject * @param int $option Where point the link * @param int $max Max length to show * @param int $short Use short labels + * @param int $notooltip 1=No tooltip * @return string String with URL */ - function getNomUrl($withpicto=0,$option=0,$max=0,$short=0) + function getNomUrl($withpicto=0,$option=0,$max=0,$short=0,$notooltip=0) { global $langs; $result=''; $label = '' . $langs->trans("ShowSending") . ''; - if (! empty($this->ref)) - $label .= '
' . $langs->trans('Ref') . ': '.$this->ref; - + $label .= '
' . $langs->trans('Ref') . ': '.$this->ref; + $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); + $url = DOL_URL_ROOT.'/expedition/card.php?id='.$this->id; if ($short) return $url; + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowSending"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; + } + $linkstart = ''; $linkend=''; $picto='sending'; - if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend); + if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$linkstart.$this->ref.$linkend; return $result; diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 19b11a0ddf6..66355a471ee 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -61,9 +61,9 @@ print "
\n"; */ $clause = " WHERE "; -$sql = "SELECT e.rowid, e.ref"; -$sql.= ", s.nom as name, s.rowid as socid"; -$sql.= ", c.ref as commande_ref, c.rowid as commande_id"; +$sql = "SELECT e.rowid, e.ref, e.ref_customer,"; +$sql.= " s.nom as name, s.rowid as socid,"; +$sql.= " c.ref as commande_ref, c.rowid as commande_id"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid"; @@ -91,11 +91,14 @@ if ($resql) $var = True; while ($i < $num) { - $var=!$var; $obj = $db->fetch_object($resql); - print "'; + $shipment->id=$obj->rowid; $shipment->ref=$obj->ref; + $shipment->ref_customer=$obj->ref_customer; + + $var=!$var; + print "'; print $shipment->getNomUrl(1); print ""; print ''; @@ -114,9 +117,9 @@ if ($resql) /* * Commandes a traiter */ -$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as name, s.rowid as socid"; -$sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; -$sql.= ", ".MAIN_DB_PREFIX."societe as s"; +$sql = "SELECT c.rowid, c.ref, c.ref_client as ref_customer, c.fk_statut, s.nom as name, s.rowid as socid"; +$sql.= " FROM ".MAIN_DB_PREFIX."commande as c,"; +$sql.= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.entity = ".$conf->entity; @@ -140,19 +143,23 @@ if ($resql) $var = True; while ($i < $num) { - $var=!$var; $obj = $db->fetch_object($resql); - print ""; - print ''; + $orderstatic->id=$obj->rowid; $orderstatic->ref=$obj->ref; + $orderstatic->ref_customer=$obj->ref_customer; $orderstatic->statut=$obj->fk_statut; $orderstatic->facturee=0; + + $companystatic->name=$obj->name; + $companystatic->id=$obj->socid; + + $var=!$var; + print ""; + print ''; print $orderstatic->getNomUrl(1); print ''; print ''; - $companystatic->name=$obj->name; - $companystatic->id=$obj->socid; print $companystatic->getNomUrl(1,'customer',32); print ''; print ''; @@ -173,9 +180,9 @@ print '
'; /* * Commandes en traitement */ -$sql = "SELECT c.rowid, c.ref, c.fk_statut as status, c.facture as billed, s.nom as name, s.rowid as socid"; -$sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; -$sql.= ", ".MAIN_DB_PREFIX."societe as s"; +$sql = "SELECT c.rowid, c.ref, c.ref_client as ref_customer, c.fk_statut as status, c.facture as billed, s.nom as name, s.rowid as socid"; +$sql.= " FROM ".MAIN_DB_PREFIX."commande as c,"; +$sql.= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.entity = ".$conf->entity; @@ -198,21 +205,25 @@ if ( $resql ) $var = True; while ($i < $num) { - $var=!$var; $obj = $db->fetch_object($resql); - print ""; - $orderstatic->id=$obj->rowid; + + $orderstatic->id=$obj->rowid; $orderstatic->ref=$obj->ref; + $orderstatic->ref_customer=$obj->ref_customer; + $orderstatic->statut=$obj->status; + $orderstatic->facturee=$obj->billed; + + $companystatic->name=$obj->name; + $companystatic->id=$obj->socid; + + $var=!$var; + print ""; print $orderstatic->getNomUrl(1); print ''; print ''; - $companystatic->name=$obj->name; - $companystatic->id=$obj->socid; print $companystatic->getNomUrl(1,'customer'); print ''; print ''; - $orderstatic->statut=$obj->status; - $orderstatic->facturee=$obj->billed; print $orderstatic->getLibStatut(3); print ''; print ''; @@ -227,9 +238,9 @@ else dol_print_error($db); /* * Last shipments */ -$sql = "SELECT e.rowid, e.ref"; -$sql.= ", s.nom as name, s.rowid as socid"; -$sql.= ", c.ref as commande_ref, c.rowid as commande_id"; +$sql = "SELECT e.rowid, e.ref, e.ref_customer,"; +$sql.= " s.nom as name, s.rowid as socid,"; +$sql.= " c.ref as commande_ref, c.rowid as commande_id"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'"; @@ -255,13 +266,19 @@ if ($resql) $var = True; while ($i < $num) { - $var=!$var; $obj = $db->fetch_object($resql); - print ''.img_object($langs->trans("ShowSending"),"sending").' '; - print $obj->ref.''; + + $shipment->id=$obj->rowid; + $shipment->ref=$obj->ref; + $shipment->ref_customer=$obj->ref_customer; + + $var=!$var; + print ''; + print $shipment->getNomUrl(1); + print ''; print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''; print ''; - if ($obj->commande_id) + if ($obj->commande_id > 0) { $orderstatic->id=$obj->commande_id; $orderstatic->ref=$obj->commande_ref; From ef03f59e508bd7acca2b7528d0211cc22c0520ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2016 12:16:46 +0100 Subject: [PATCH 07/56] Uniformize code --- dev/skeletons/skeleton_list.php | 588 +++++++++++++------------ htdocs/commande/list.php | 70 +-- htdocs/contact/card.php | 4 +- htdocs/contact/list.php | 757 ++++++++++++++++---------------- htdocs/societe/list.php | 88 ++-- 5 files changed, 769 insertions(+), 738 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 27515db3c68..da8a9995538 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -141,22 +141,23 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - -// Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers -{ - $search_field1=''; - $search_field2=''; - $search_date_creation=''; - $search_date_update=''; - $toselect=''; - $search_array_options=array(); -} - - if (empty($reshook)) { + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + { + $search_field1=''; + $search_field2=''; + $search_date_creation=''; + $search_date_update=''; + $toselect=''; + $search_array_options=array(); + } + + // Mass actions $objectclass='Skeleton'; $objectlabel='Skeleton'; $permtoread = $user->rights->skeleton->read; @@ -180,7 +181,6 @@ $form=new Form($db); //$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; $help_url=''; $title = $langs->trans('MyModuleListTitle'); -llxHeader('', $title, $help_url); // Put here content of your page @@ -250,298 +250,306 @@ $sql.= $db->plimit($limit+1, $offset); dol_syslog($script_file, LOG_DEBUG); $resql=$db->query($sql); -if ($resql) +if (! $resql) { - $num = $db->num_rows($resql); - - $arrayofselected=is_array($toselect)?$toselect:array(); - - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($search_field1 != '') $param.= '&search_field1='.urlencode($search_field1); - if ($search_field2 != '') $param.= '&search_field2='.urlencode($search_field2); - if ($optioncss != '') $param.='&optioncss='.$optioncss; - // Add $param from extra fields - foreach ($search_array_options as $key => $val) + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + +// Direct jump if only one record found +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/skeleton/card.php?id='.$id); + exit; +} + +llxHeader('', $title, $help_url); + +$arrayofselected=is_array($toselect)?$toselect:array(); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($search_field1 != '') $param.= '&search_field1='.urlencode($search_field1); +if ($search_field2 != '') $param.= '&search_field2='.urlencode($search_field2); +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); +} + +$arrayofmassactions = array( + 'presend'=>$langs->trans("SendByMail"), + 'builddoc'=>$langs->trans("PDFMerge"), +); +if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); +if ($massaction == 'presend') $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); +} + +$moreforfilter = ''; +$moreforfilter.='
'; +$moreforfilter.= $langs->trans('MyFilter') . ': '; +$moreforfilter.= '
'; + +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook +if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; +else $moreforfilter = $hookmanager->resPrint; + +if (! empty($moreforfilter)) +{ + print '
'; + print $moreforfilter; + print '
'; +} + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + +print ''."\n"; + +// Fields title +print ''; +// LIST_OF_TD_TITLE_FIELDS +//if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); +//if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$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; +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); +//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); +print ''."\n"; + +// Fields title search +print ''; +// LIST_OF_TD_TITLE_SEARCH +//if (! empty($arrayfields['t.field1']['checked'])) print ''; +//if (! empty($arrayfields['t.field2']['checked'])) print ''; +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) { - $crit=$val; - $tmpkey=preg_replace('/search_options_/','',$key); - if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); - } - - $arrayofmassactions = array( - 'presend'=>$langs->trans("SendByMail"), - 'builddoc'=>$langs->trans("PDFMerge"), - ); - if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - - print ''; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); - - if ($sall) - { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); - } - - $moreforfilter = ''; - $moreforfilter.='
'; - $moreforfilter.= $langs->trans('MyFilter') . ': '; - $moreforfilter.= '
'; - - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; - else $moreforfilter = $hookmanager->resPrint; - - if (! empty($moreforfilter)) - { - print '
'; - print $moreforfilter; - print '
'; - } - - $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; - $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - - print '
'."\n"; - - // Fields title - print ''; - // LIST_OF_TD_TITLE_FIELDS - //if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); - //if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$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; - 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); - //if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print ''."\n"; - - // Fields title search - print ''; - // LIST_OF_TD_TITLE_SEARCH - //if (! empty($arrayfields['t.field1']['checked'])) print ''; - //if (! empty($arrayfields['t.field2']['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'])) { - if (! empty($arrayfields["ef.".$key]['checked'])) - { - $align=$extrafields->getAlignFlag($key); - $typeofextrafield=$extrafields->attribute_type[$key]; - print ''; - } + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + 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 ''; - } - /*if (! empty($arrayfields['u.statut']['checked'])) - { - // Status - print ''; - }*/ - // Action column - print ''; - print ''."\n"; - +} +if (! empty($arrayfields['t.tms']['checked'])) +{ + // Date modification + print ''; +} +/*if (! empty($arrayfields['u.statut']['checked'])) +{ + // Status + print ''; +}*/ +// Action column +print ''; +print ''."\n"; - $i=0; - $var=true; - $totalarray=array(); - while ($i < min($num, $limit)) + +$i=0; +$var=true; +$totalarray=array(); +while ($i < min($num, $limit)) +{ + $obj = $db->fetch_object($resql); + if ($obj) { - $obj = $db->fetch_object($resql); - if ($obj) + $var = !$var; + + // Show here line of result + print ''; + // LIST_OF_TD_FIELDS_LIST + /* + if (! empty($arrayfields['t.field1']['checked'])) { - $var = !$var; - - // Show here line of result - print ''; - // LIST_OF_TD_FIELDS_LIST - /* - if (! empty($arrayfields['t.field1']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['t.field2']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - }*/ - // 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 ''; - if (! $i) $totalarray['nbfield']++; - } - } - } - // 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 ''; - if (! $i) $totalarray['nbfield']++; - } - // Date modification - if (! empty($arrayfields['t.tms']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Status - /* - if (! empty($arrayfields['u.statut']['checked'])) - { - $userstatic->statut=$obj->statut; - print ''; - }*/ - - // Action column - print ''; - if (! $i) $totalarray['nbfield']++; - - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } - $i++; + if (! empty($arrayfields['t.field2']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + }*/ + // 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 ''; + if (! $i) $totalarray['nbfield']++; + } + } + } + // 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 ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['t.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + /* + if (! empty($arrayfields['u.statut']['checked'])) + { + $userstatic->statut=$obj->statut; + print ''; + }*/ + + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print ''; } - - // Show total line - if (isset($totalarray['totalhtfield'])) - { - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if ($i == 1) - { - if ($num < $limit) print ''; - else print ''; - } - elseif ($totalarray['totalhtfield'] == $i) print ''; - elseif ($totalarray['totalvatfield'] == $i) print ''; - elseif ($totalarray['totalttcfield'] == $i) print ''; - else print ''; - } - print ''; - } - - $db->free($resql); + $i++; +} - $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); - $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; +// Show total line +if (isset($totalarray['totalhtfield'])) +{ + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totalhtfield'] == $i) print ''; + elseif ($totalarray['totalvatfield'] == $i) print ''; + elseif ($totalarray['totalttcfield'] == $i) print ''; + else print ''; + } + print ''; +} - print '
'; - if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) - { - $crit=$val; - $tmpkey=preg_replace('/search_options_/','',$key); - $searchclass=''; - if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; - if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; - print ''; - } - print ''; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + print ''; - print ''; - print ''; - print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); - print ''; - $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); - print $searchpitco; +} +// 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 ''; print '
'; + print ''; + print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); + print ''; +$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); +print $searchpitco; +print '
'.$obj->field1.''.$obj->field2.''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour'); - print ''.$userstatic->getLibStatut(3).''; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - { - $selected=0; - if (in_array($obj->rowid, $arrayofselected)) $selected=1; - print ''; - } - print '
'.$obj->field1.''.$obj->field2.''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''.$userstatic->getLibStatut(3).''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).'
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).'
'."\n"; +$db->free($resql); - print '
'."\n"; - - - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) - { - // Show list of available documents - $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; - $urlsource.=str_replace('&','&',$param); - - $filedir=$diroutputmassaction; - $genallowed=$user->rights->facture->lire; - $delallowed=$user->rights->facture->lire; - - print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); - } - else - { - print '
'.$langs->trans("ShowTempMassFilesArea").''; - } - +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print ''."\n"; + +print ''."\n"; + + +if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) +{ + // Show list of available documents + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource.=str_replace('&','&',$param); + + $filedir=$diroutputmassaction; + $genallowed=$user->rights->facture->lire; + $delallowed=$user->rights->facture->lire; + + print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); } else { - $error++; - dol_print_error($db); + print '
'.$langs->trans("ShowTempMassFilesArea").''; } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 455db14e3ed..14c2b88214e 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -161,41 +161,43 @@ $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - -// Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers -{ - $search_categ=''; - $search_user=''; - $search_sale=''; - $search_product_category=''; - $search_ref=''; - $search_ref_customer=''; - $search_company=''; - $search_town=''; - $search_zip=""; - $search_state=""; - $search_type=''; - $search_country=''; - $search_type_thirdparty=''; - $search_total_ht=''; - $search_total_vat=''; - $search_total_ttc=''; - $orderyear=''; - $ordermonth=''; - $orderday=''; - $deliveryday=''; - $deliverymonth=''; - $deliveryyear=''; - $viewstatut=''; - $billed=''; - $toselect=''; - $search_array_options=array(); -} - if (empty($reshook)) { + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + { + $search_categ=''; + $search_user=''; + $search_sale=''; + $search_product_category=''; + $search_ref=''; + $search_ref_customer=''; + $search_company=''; + $search_town=''; + $search_zip=""; + $search_state=""; + $search_type=''; + $search_country=''; + $search_type_thirdparty=''; + $search_total_ht=''; + $search_total_vat=''; + $search_total_ttc=''; + $orderyear=''; + $ordermonth=''; + $orderday=''; + $deliveryday=''; + $deliverymonth=''; + $deliveryyear=''; + $viewstatut=''; + $billed=''; + $toselect=''; + $search_array_options=array(); + } + + // Mass actions $objectclass='Commande'; $objectlabel='Orders'; $permtoread = $user->rights->commande->lire; @@ -205,7 +207,7 @@ if (empty($reshook)) } -if($massaction == 'confirm_createbills') { +if ($massaction == 'confirm_createbills') { $orders = GETPOST('toselect'); $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 23242559f1f..a2f97d9ad93 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1254,9 +1254,9 @@ else print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),$out,''); - print show_actions_todo($conf,$langs,$db,$objsoc,$object); + //print show_actions_todo($conf,$langs,$db,$objsoc,$object); - print show_actions_done($conf,$langs,$db,$objsoc,$object); + print show_actions_done($conf,$langs,$db,$objsoc,$object,0,'',''); } } } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index b8c96884e96..bc8c3235242 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -165,39 +165,51 @@ if (($id > 0 || ! empty($ref)) && $action != 'add') * Actions */ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - if (empty($reshook)) { - + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers + { + $sall=""; + $search_firstlast_only=""; + $search_lastname=""; + $search_firstname=""; + $search_societe=""; + $search_poste=""; + $search_phone=""; + $search_phone_perso=""; + $search_phone_pro=""; + $search_phone_mobile=""; + $search_fax=""; + $search_email=""; + $search_skype=""; + $search_priv=""; + $search_status=-1; + $search_categ=''; + $search_categ_thirdparty=''; + $search_categ_supplier=''; + $search_array_options=array(); + } + + // Mass actions + $objectclass='Contact'; + $objectlabel='Contact'; + $permtoread = $user->rights->societe->lire; + $permtodelete = $user->rights->societe->delete; + $uploaddir = $conf->societe->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } -if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers -{ - $sall=""; - $search_firstlast_only=""; - $search_lastname=""; - $search_firstname=""; - $search_societe=""; - $search_poste=""; - $search_phone=""; - $search_phone_perso=""; - $search_phone_pro=""; - $search_phone_mobile=""; - $search_fax=""; - $search_email=""; - $search_skype=""; - $search_priv=""; - $search_status=-1; - $search_categ=''; - $search_categ_thirdparty=''; - $search_categ_supplier=''; - $search_array_options=array(); -} if ($search_priv < 0) $search_priv=''; @@ -210,7 +222,6 @@ $formother=new FormOther($db); $contactstatic=new Contact($db); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); -llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'); $sql = "SELECT s.rowid as socid, s.nom as name,"; $sql.= " p.rowid as cidp, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.skype,"; @@ -343,7 +354,6 @@ foreach ($search_array_options as $key => $val) $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; - // Add order if ($view == "recent") { @@ -367,219 +377,371 @@ $sql.= $db->plimit($limit+1, $offset); //print $sql; dol_syslog("contact/list.php", LOG_DEBUG); $result = $db->query($sql); -if ($result) +if (! $result) { - $num = $db->num_rows($result); - $i = 0; + dol_print_error($db); + exit; +} - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - $param.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); - $param.='&type='.urlencode($type).'&view='.urlencode($view); - if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ); - if (!empty($search_categ_thirdparty)) $param.='&search_categ_thirdparty='.urlencode($search_categ_thirdparty); - if (!empty($search_categ_supplier)) $param.='&search_categ_supplier='.urlencode($search_categ_supplier); - if ($sall != '') $param.='&sall='.urlencode($sall); - if ($search_lastname != '') $param.='&search_lastname='.urlencode($search_lastname); - if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname); - if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe); - if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); - if ($search_town != '') $param.='&search_town='.urlencode($search_town); - if ($search_job != '') $param.='&search_job='.urlencode($search_job); - if ($search_phone_pro != '') $param.='&search_phone_pro='.urlencode($search_phone_pro); - if ($search_phone_perso != '') $param.='&search_phone_perso='.urlencode($search_phone_perso); - if ($search_phone_mobile != '') $param.='&search_phone_mobile='.urlencode($search_phone_mobile); - if ($search_fax != '') $param.='&search_fax='.urlencode($search_fax); - if ($search_email != '') $param.='&search_email='.urlencode($search_email); - if ($search_status != '') $param.='&search_status='.urlencode($search_status); - if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); - 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 '
'; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; +$num = $db->num_rows($result); - print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit); +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) +{ + $obj = $db->fetch_object($resql); + $id = $obj->cidp; + header("Location: ".DOL_URL_ROOT.'/contact/card.php?id='.$id); + exit; +} - if ($sall) - { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); - } - if ($search_firstlast_only) +llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +$param.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); +$param.='&type='.urlencode($type).'&view='.urlencode($view); +if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ); +if (!empty($search_categ_thirdparty)) $param.='&search_categ_thirdparty='.urlencode($search_categ_thirdparty); +if (!empty($search_categ_supplier)) $param.='&search_categ_supplier='.urlencode($search_categ_supplier); +if ($sall != '') $param.='&sall='.urlencode($sall); +if ($search_lastname != '') $param.='&search_lastname='.urlencode($search_lastname); +if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname); +if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe); +if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); +if ($search_town != '') $param.='&search_town='.urlencode($search_town); +if ($search_job != '') $param.='&search_job='.urlencode($search_job); +if ($search_phone_pro != '') $param.='&search_phone_pro='.urlencode($search_phone_pro); +if ($search_phone_perso != '') $param.='&search_phone_perso='.urlencode($search_phone_perso); +if ($search_phone_mobile != '') $param.='&search_phone_mobile='.urlencode($search_phone_mobile); +if ($search_fax != '') $param.='&search_fax='.urlencode($search_fax); +if ($search_email != '') $param.='&search_email='.urlencode($search_email); +if ($search_status != '') $param.='&search_status='.urlencode($search_status); +if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); +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 ''; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit); + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); +} +if ($search_firstlast_only) +{ + print $langs->trans("FilterOnInto", $search_firstlast_only) . $langs->trans("Lastname").", ".$langs->trans("Firstname"); +} + +if (! empty($conf->categorie->enabled)) +{ + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('Categories'). ': '; + $moreforfilter.=$formother->select_categories(Categorie::TYPE_CONTACT,$search_categ,'search_categ',1); + $moreforfilter.='
'; + if (empty($type) || $type == 'c' || $type == 'p') { - print $langs->trans("FilterOnInto", $search_firstlast_only) . $langs->trans("Lastname").", ".$langs->trans("Firstname"); - } - - if (! empty($conf->categorie->enabled)) - { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $moreforfilter.='
'; - $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$formother->select_categories(Categorie::TYPE_CONTACT,$search_categ,'search_categ',1); + if ($type == 'c') $moreforfilter.=$langs->trans('CustomersCategoriesShort'). ': '; + else if ($type == 'p') $moreforfilter.=$langs->trans('ProspectsCategoriesShort'). ': '; + else $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort'). ': '; + $moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ_thirdparty,'search_categ_thirdparty',1); $moreforfilter.='
'; - if (empty($type) || $type == 'c' || $type == 'p') - { - $moreforfilter.='
'; - if ($type == 'c') $moreforfilter.=$langs->trans('CustomersCategoriesShort'). ': '; - else if ($type == 'p') $moreforfilter.=$langs->trans('ProspectsCategoriesShort'). ': '; - else $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort'). ': '; - $moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ_thirdparty,'search_categ_thirdparty',1); - $moreforfilter.='
'; - } - if (empty($type) || $type == 'f') - { - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('SuppliersCategoriesShort'). ': '; - $moreforfilter.=$formother->select_categories(Categorie::TYPE_SUPPLIER,$search_categ_supplier,'search_categ_supplier',1); - $moreforfilter.='
'; - } - } - if ($moreforfilter) - { - print '
'; - print $moreforfilter; - $parameters=array('type'=>$type); - $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 ''; - - // Ligne des titres - print ''; - if (! empty($arrayfields['p.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.firstname']['checked'])) print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.zip']['checked'])) print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"p.zip", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"p.town", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($langs->trans("PhonePerso"),$_SERVER["PHP_SELF"],"p.phone_perso", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($langs->trans("Skype"),$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder); - if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($langs->trans("ContactVisibility"),$_SERVER["PHP_SELF"],"p.priv", $begin, $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 + if (empty($type) || $type == 'f') + { + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('SuppliersCategoriesShort'). ': '; + $moreforfilter.=$formother->select_categories(Categorie::TYPE_SUPPLIER,$search_categ_supplier,'search_categ_supplier',1); + $moreforfilter.='
'; + } +} +if ($moreforfilter) +{ + print '
'; + print $moreforfilter; + $parameters=array('type'=>$type); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$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.statut","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "
\n"; + print ''; +} - // Lines for filter fields - print ''; +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + +print '
'; + +// Ligne des titres +print ''; +if (! empty($arrayfields['p.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.firstname']['checked'])) print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.zip']['checked'])) print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"p.zip", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"p.town", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($langs->trans("PhonePerso"),$_SERVER["PHP_SELF"],"p.phone_perso", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($langs->trans("Skype"),$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($langs->trans("ContactVisibility"),$_SERVER["PHP_SELF"],"p.priv", $begin, $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; +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.statut","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + +// Lines for filter fields +print ''; +if (! empty($arrayfields['p.lastname']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.firstname']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.poste']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.zip']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.town']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.phone']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.phone_perso']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.phone_mobile']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.fax']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.email']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.skype']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.thirdparty']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.priv']['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; +// Date creation +if (! empty($arrayfields['p.datec']['checked'])) +{ + print ''; +} +// Date modification +if (! empty($arrayfields['p.tms']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.statut']['checked'])) +{ + print ''; +} +print ''; + +print ''; + +$var=True; +$i = 0; +while ($i < min($num,$limit)) +{ + $obj = $db->fetch_object($result); + + $var=!$var; + print ""; + + $contactstatic->lastname=$obj->lastname; + $contactstatic->firstname=''; + $contactstatic->id=$obj->cidp; + $contactstatic->statut=$obj->statut; + $contactstatic->poste=$obj->poste; + $contactstatic->phone_pro=$obj->phone_pro; + $contactstatic->phone_perso=$obj->phone_perso; + $contactstatic->phone_mobile=$obj->phone_mobile; + $contactstatic->zip=$obj->zip; + $contactstatic->town=$obj->town; + + // Name if (! empty($arrayfields['p.lastname']['checked'])) { - print ''; + print ''; } + // Firstname if (! empty($arrayfields['p.firstname']['checked'])) { - print ''; - } - if (! empty($arrayfields['p.poste']['checked'])) - { - print ''; + print ''; } + // Zip if (! empty($arrayfields['p.zip']['checked'])) { - print ''; + print ''; } + // Town if (! empty($arrayfields['p.town']['checked'])) { - print ''; + print ''; } - if (! empty($arrayfields['p.phone']['checked'])) + // Function + if (! empty($arrayfields['p.poste']['checked'])) { - print ''; + print ''; } - if (! empty($arrayfields['p.phone_perso']['checked'])) + // Phone + if (! empty($arrayfields['p.phone']['checked'])) { - print ''; + print ''; } + // Phone perso + if (! empty($arrayfields['p.phone_perso']['checked'])) + { + print ''; + } + // Phone mobile if (! empty($arrayfields['p.phone_mobile']['checked'])) { - print ''; + print ''; } + // Fax if (! empty($arrayfields['p.fax']['checked'])) { - print ''; + print ''; } + // EMail if (! empty($arrayfields['p.email']['checked'])) { - print ''; + print ''; } + // Skype if (! empty($arrayfields['p.skype']['checked'])) { - print ''; + if (! empty($conf->skype->enabled)) { print ''; } } + // Company if (! empty($arrayfields['p.thirdparty']['checked'])) { - print ''; } + + // Private/Public if (! empty($arrayfields['p.priv']['checked'])) { - print ''; + print ''; } + // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -587,203 +749,58 @@ if ($result) { 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 + $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['p.datec']['checked'])) { - print ''; } // Date modification if (! empty($arrayfields['p.tms']['checked'])) { - print ''; } + // Status if (! empty($arrayfields['p.statut']['checked'])) { - print ''; + print ''; } - print ''; - - print ''; + // Action column - Links Add action and Export vcard + print ''; - $var=True; - while ($i < min($num,$limit)) - { - $obj = $db->fetch_object($result); - - $var=!$var; - print ""; - - $contactstatic->lastname=$obj->lastname; - $contactstatic->firstname=''; - $contactstatic->id=$obj->cidp; - $contactstatic->statut=$obj->statut; - $contactstatic->poste=$obj->poste; - $contactstatic->phone_pro=$obj->phone_pro; - $contactstatic->phone_perso=$obj->phone_perso; - $contactstatic->phone_mobile=$obj->phone_mobile; - $contactstatic->zip=$obj->zip; - $contactstatic->town=$obj->town; - - // Name - if (! empty($arrayfields['p.lastname']['checked'])) - { - print ''; - } - // Firstname - if (! empty($arrayfields['p.firstname']['checked'])) - { - print ''; - } - // Zip - if (! empty($arrayfields['p.zip']['checked'])) - { - print ''; - } - // Town - if (! empty($arrayfields['p.town']['checked'])) - { - print ''; - } - // Function - if (! empty($arrayfields['p.poste']['checked'])) - { - print ''; - } - // Phone - if (! empty($arrayfields['p.phone']['checked'])) - { - print ''; - } - // Phone perso - if (! empty($arrayfields['p.phone_perso']['checked'])) - { - print ''; - } - // Phone mobile - if (! empty($arrayfields['p.phone_mobile']['checked'])) - { - print ''; - } - // Fax - if (! empty($arrayfields['p.fax']['checked'])) - { - print ''; - } - // EMail - if (! empty($arrayfields['p.email']['checked'])) - { - print ''; - } - // Skype - if (! empty($arrayfields['p.skype']['checked'])) - { - if (! empty($conf->skype->enabled)) { print ''; } - } - // Company - if (! empty($arrayfields['p.thirdparty']['checked'])) - { - print ''; - } - - // Private/Public - if (! empty($arrayfields['p.priv']['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['p.datec']['checked'])) - { - print ''; - } - // Date modification - if (! empty($arrayfields['p.tms']['checked'])) - { - print ''; - } - // Status - if (! empty($arrayfields['p.statut']['checked'])) - { - print ''; - } - // Action column - Links Add action and Export vcard - print ''; - - print "\n"; - $i++; - } - - print "
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); + print $form->selectarray('search_priv',$selectarray,$search_priv,1); + print ''; + print ''; + print ''; + print ''; + print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); + print ''; +print ''; +print ''; +print '
'; - print ''; - print ''; + print $contactstatic->getNomUrl(1,'',0); + print ''; - print ''; - print ''; - print ''; - print ''.$obj->firstname.''; - print ''; - print ''.$obj->zip.''; - print ''; - print ''.$obj->town.''; - print ''; - print ''.dol_trunc($obj->poste,20).''; - print ''; - print ''.dol_print_phone($obj->phone_pro,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').''.dol_print_phone($obj->phone_perso,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').''; - print ''; - print ''.dol_print_phone($obj->phone_mobile,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').''; - print ''; - print ''.dol_print_phone($obj->fax,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').''; - print ''; - print ''.dol_print_email($obj->email,$obj->cidp,$obj->socid,'AC_EMAIL',18).''; - print ''; - print ''.dol_print_skype($obj->skype,$obj->cidp,$obj->socid,'AC_SKYPE',18).''; - print ''; + print ''; + if ($obj->socid) + { + $objsoc = new Societe($db); + $objsoc->fetch($obj->socid); + print $objsoc->getNomUrl(1); + } + else + print ' '; print ''; - $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); - print $form->selectarray('search_priv',$selectarray,$search_priv,1); - print ''.$contactstatic->LibPubPriv($obj->priv).''; + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print ''; + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); print ''; + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''; - print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); - print ''.$contactstatic->getLibStatut(3).''; - print ''; - print ''; - print '
'; + print ''.img_object($langs->trans("AddAction"),"action").''; + print '   '; + print ''; + print img_picto($langs->trans("VCard"),'vcard.png').' '; + print '
'; - print $contactstatic->getNomUrl(1,'',0); - print ''.$obj->firstname.''.$obj->zip.''.$obj->town.''.dol_trunc($obj->poste,20).''.dol_print_phone($obj->phone_pro,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').''.dol_print_phone($obj->phone_perso,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').''.dol_print_phone($obj->phone_mobile,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').''.dol_print_phone($obj->fax,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').''.dol_print_email($obj->email,$obj->cidp,$obj->socid,'AC_EMAIL',18).''.dol_print_skype($obj->skype,$obj->cidp,$obj->socid,'AC_SKYPE',18).''; - if ($obj->socid) - { - $objsoc = new Societe($db); - $objsoc->fetch($obj->socid); - print $objsoc->getNomUrl(1); - } - else - print ' '; - print ''.$contactstatic->LibPubPriv($obj->priv).''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour'); - print ''.$contactstatic->getLibStatut(3).''; - print ''.img_object($langs->trans("AddAction"),"action").''; - print '   '; - print ''; - print img_picto($langs->trans("VCard"),'vcard.png').' '; - print '
"; - - if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit, 1); - - print '
'; - - $db->free($result); -} -else -{ - dol_print_error($db); + print "\n"; + $i++; } -print '
'; +print ""; + +if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit, 1); + +print ''; + +$db->free($result); llxFooter(); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 40ef1e6c896..96c527f3976 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -181,54 +181,58 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab * Actions */ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - if (empty($reshook)) { - if ($action == 'setstcomm') - { - $object = new Client($db); - $result=$object->fetch(GETPOST('stcommsocid')); - $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm'); - $result=$object->update($object->id, $user); - if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - $action=''; - } -} + // Do we click on purge search criteria ? + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + { + $search_nom=''; + $search_categ=0; + $search_sale=''; + $search_barcode=""; + $search_customer_code=''; + $search_supplier_code=''; + $search_account_customer_code=''; + $search_account_supplier_code=''; + $search_town=""; + $search_zip=""; + $search_state=""; + $search_country=''; + $search_idprof1=''; + $search_idprof2=''; + $search_idprof3=''; + $search_idprof4=''; + $search_idprof5=''; + $search_idprof6=''; + $search_type=''; + $search_type_thirdparty=''; + $search_status=''; + $search_stcomm=''; + $search_level_from=''; + $search_level_to=''; + $search_array_options=array(); + } -// Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $search_nom=''; - $search_categ=0; - $search_sale=''; - $search_barcode=""; - $search_customer_code=''; - $search_supplier_code=''; - $search_account_customer_code=''; - $search_account_supplier_code=''; - $search_town=""; - $search_zip=""; - $search_state=""; - $search_country=''; - $search_idprof1=''; - $search_idprof2=''; - $search_idprof3=''; - $search_idprof4=''; - $search_idprof5=''; - $search_idprof6=''; - $search_type=''; - $search_type_thirdparty=''; - $search_status=''; - $search_stcomm=''; - $search_level_from=''; - $search_level_to=''; - $search_array_options=array(); + if ($action == 'setstcomm') + { + $object = new Client($db); + $result=$object->fetch(GETPOST('stcommsocid')); + $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm'); + $result=$object->update($object->id, $user); + if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); + + $action=''; + } } if ($search_status=='') $search_status=1; // always display active thirdparty first @@ -439,7 +443,7 @@ if (! $resql) } $num = $db->num_rows($resql); -$i = 0; + if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) { $obj = $db->fetch_object($resql); @@ -848,7 +852,7 @@ print ''; print "\n"; $var=True; - +$i = 0; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); From 7fa96924588c7dde4280141e6f49f847cd9473a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2016 12:48:50 +0100 Subject: [PATCH 08/56] Uniformize code. Generalize option MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE. --- dev/skeletons/skeleton_list.php | 4 +- htdocs/adherents/list.php | 1023 ++++++++++++++-------------- htdocs/contact/list.php | 2 +- htdocs/product/list.php | 52 +- htdocs/projet/list.php | 1122 ++++++++++++++++--------------- htdocs/projet/tasks/list.php | 1053 +++++++++++++++-------------- htdocs/societe/list.php | 2 +- htdocs/user/index.php | 784 ++++++++++----------- 8 files changed, 2057 insertions(+), 1985 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index da8a9995538..c47a87a8033 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -58,6 +58,7 @@ $action = GETPOST('action','alpha'); $backtopage = GETPOST('backtopage'); $myparam = GETPOST('myparam','alpha'); +$search_all=trim(GETPOST("sall")); $search_field1=GETPOST("search_field1"); $search_field2=GETPOST("search_field2"); $search_myfield=GETPOST('search_myfield'); @@ -247,7 +248,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->plimit($limit+1, $offset); - dol_syslog($script_file, LOG_DEBUG); $resql=$db->query($sql); if (! $resql) @@ -259,7 +259,7 @@ if (! $resql) $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { $obj = $db->fetch_object($resql); $id = $obj->rowid; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index d3e7e96a793..c98ad4abf31 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -129,44 +129,49 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab } } + /* * Actions */ if (GETPOST('cancel')) { $action='list'; $massaction=''; } -if (! GETPOST('confirmmassaction')) { $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; } $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - -// Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (empty($reshook)) { - $search=""; - $search_ref=""; - $search_lastname=""; - $search_firstname=""; - $search_login=""; - $search_company=""; - $type=""; - $search_email=""; - $search_address=""; - $search_zip=""; - $search_town=""; - $search_state=""; - $search_country=''; - $search_phone=''; - $search_phone_perso=''; - $search_phone_mobile=''; - $search_morphy=""; - $search_categ=""; - $catid=""; - $sall=""; - $statut=''; - $search_array_options=array(); + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + { + $search=""; + $search_ref=""; + $search_lastname=""; + $search_firstname=""; + $search_login=""; + $search_company=""; + $type=""; + $search_email=""; + $search_address=""; + $search_zip=""; + $search_town=""; + $search_state=""; + $search_country=''; + $search_phone=''; + $search_phone_perso=''; + $search_phone_mobile=''; + $search_morphy=""; + $search_categ=""; + $catid=""; + $sall=""; + $statut=''; + $search_array_options=array(); + } } @@ -179,8 +184,6 @@ $formother=new FormOther($db); $membertypestatic=new AdherentType($db); $memberstatic=new Adherent($db); -llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); - $now=dol_now(); $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,"; @@ -259,263 +262,510 @@ $sql.= $db->plimit($limit+1, $offset); dol_syslog("get list", LOG_DEBUG); $resql = $db->query($sql); -if ($resql) +if (! $resql) { - $num = $db->num_rows($resql); - $i = 0; + dol_print_error($db); + exit; +} - $titre=$langs->trans("MembersList"); - if (isset($_GET["statut"])) - { - if ($statut == '-1,1') { $titre=$langs->trans("MembersListQualified"); } - if ($statut == '-1') { $titre=$langs->trans("MembersListToValid"); } - if ($statut == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); } - if ($statut == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); } - if ($statut == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); } - if ($statut == '0') { $titre=$langs->trans("MembersListResiliated"); } - } - elseif ($action == 'search') - { - $titre=$langs->trans("MembersListQualified"); - } +$num = $db->num_rows($resql); - if ($type > 0) - { - $membertype=new AdherentType($db); - $result=$membertype->fetch(GETPOST("type")); - $titre.=" (".$membertype->libelle.")"; - } +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/adherents/card.php?id='.$id); + exit; +} - $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($statut != "") $param.="&statut=".urlencode($statut); - if ($search_ref) $param.="&search_ref=".urlencode($search_ref); - if ($search_nom) $param.="&search_nom=".urlencode($search_nom); - if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname); - if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname); - if ($search_login) $param.="&search_login=".urlencode($search_login); - if ($search_email) $param.="&search_email=".urlencode($search_email); - if ($search_company) $param.="&search_company=".urlencode($search_company); - if ($search_address != '') $param.= "&search_address=".urlencode($search_address); - if ($search_town != '') $param.= "&search_town=".urlencode($search_town); - if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip); - if ($search_state != '') $param.= "&search_state=".urlencode($search_state); - if ($search_country != '') $param.= "&search_country=".urlencode($search_country); - if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone); - if ($search_phone_perso != '') $param.= "&search_phone_perso=".urlencode($search_phone_perso); - if ($search_phone_mobile != '') $param.= "&search_phone_mobile=".urlencode($search_phone_mobile); - if ($filter) $param.="&filter=".urlencode($filter); - if ($type > 0) $param.="&type=".urlencode($type); - if ($optioncss != '') $param.='&optioncss='.urlencode($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); - } +llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); + +$titre=$langs->trans("MembersList"); +if (isset($_GET["statut"])) +{ + if ($statut == '-1,1') { $titre=$langs->trans("MembersListQualified"); } + if ($statut == '-1') { $titre=$langs->trans("MembersListToValid"); } + if ($statut == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); } + if ($statut == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); } + if ($statut == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); } + if ($statut == '0') { $titre=$langs->trans("MembersListResiliated"); } +} +elseif ($action == 'search') +{ + $titre=$langs->trans("MembersListQualified"); +} + +if ($type > 0) +{ + $membertype=new AdherentType($db); + $result=$membertype->fetch(GETPOST("type")); + $titre.=" (".$membertype->libelle.")"; +} + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($sall != "") $param.="&sall=".urlencode($sall); +if ($statut != "") $param.="&statut=".urlencode($statut); +if ($search_ref) $param.="&search_ref=".urlencode($search_ref); +if ($search_nom) $param.="&search_nom=".urlencode($search_nom); +if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname); +if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname); +if ($search_login) $param.="&search_login=".urlencode($search_login); +if ($search_email) $param.="&search_email=".urlencode($search_email); +if ($search_company) $param.="&search_company=".urlencode($search_company); +if ($search_address != '') $param.= "&search_address=".urlencode($search_address); +if ($search_town != '') $param.= "&search_town=".urlencode($search_town); +if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip); +if ($search_state != '') $param.= "&search_state=".urlencode($search_state); +if ($search_country != '') $param.= "&search_country=".urlencode($search_country); +if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone); +if ($search_phone_perso != '') $param.= "&search_phone_perso=".urlencode($search_phone_perso); +if ($search_phone_mobile != '') $param.= "&search_phone_mobile=".urlencode($search_phone_mobile); +if ($filter) $param.="&filter=".urlencode($filter); +if ($type > 0) $param.="&type=".urlencode($type); +if ($optioncss != '') $param.='&optioncss='.urlencode($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); +} + +//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . implode(', ',$fieldstosearchall); +} + +// Filter on categories +$moreforfilter=''; +if (! empty($conf->categorie->enabled)) +{ + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('Categories'). ': '; + $moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1); + $moreforfilter.='
'; +} +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook +if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; +else $moreforfilter = $hookmanager->resPrint; +if (! empty($moreforfilter)) +{ + print '
'; + print $moreforfilter; + print '
'; +} + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + +print ''."\n"; +print ''; +if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) +{ + print ''; +} +if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'],$_SERVER["PHP_SELF"],'t.libelle','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$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; +if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'],$_SERVER["PHP_SELF"],"d.statut","",$param,'align="right"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + +// Line for filters fields +print ''; + +// Line numbering +if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) +{ + print ''; +} + +// Ref +if (! empty($arrayfields['d.ref']['checked'])) +{ + print ''; +} + +if (! empty($arrayfields['d.firstname']['checked'])) +{ + print ''; +} + +if (! empty($arrayfields['d.lastname']['checked'])) +{ + print ''; +} + +if (! empty($arrayfields['d.company']['checked'])) +{ + print ''; +} + +if (! empty($arrayfields['d.login']['checked'])) +{ + print ''; +} + +if (! empty($arrayfields['d.morphy']['checked'])) +{ + print ''; +} + +if (! empty($arrayfields['t.libelle']['checked'])) +{ + print ''; +} + +if (! empty($arrayfields['d.address']['checked'])) +{ + print ''; +} + +if (! empty($arrayfields['d.zip']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['d.town']['checked'])) +{ + print ''; +} +// State +if (! empty($arrayfields['state.nom']['checked'])) +{ + print ''; +} +// Country +if (! empty($arrayfields['country.code_iso']['checked'])) +{ + print ''; +} +// Phone pro +if (! empty($arrayfields['d.phone']['checked'])) +{ + print ''; +} +// Phone perso +if (! empty($arrayfields['d.phone_perso']['checked'])) +{ + print ''; +} +// Phone mobile +if (! empty($arrayfields['d.phone_mobile']['checked'])) +{ + print ''; +} +// Email +if (! empty($arrayfields['d.email']['checked'])) +{ + print ''; +} + +if (! empty($arrayfields['d.datefin']['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'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + 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; +// Date creation +if (! empty($arrayfields['d.datec']['checked'])) +{ + print ''; +} +// Date modification +if (! empty($arrayfields['d.tms']['checked'])) +{ + print ''; +} +// Status +if (! empty($arrayfields['d.statut']['checked'])) +{ + print ''; +} +// Action column +print ''; + +print "\n"; + +$var=True; +$i = 0; +while ($i < $num && $i < $conf->liste_limit) +{ + $obj = $db->fetch_object($resql); + + $datefin=$db->jdate($obj->datefin); + $memberstatic->id=$obj->rowid; + $memberstatic->ref=$obj->rowid; + $memberstatic->lastname=$obj->lastname; + $memberstatic->firstname=$obj->firstname; + $memberstatic->societe=$obj->company; + $memberstatic->statut=$obj->statut; + $memberstatic->datefin= $datefin; + $memberstatic->socid = $obj->fk_soc; - //$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); - - print ''; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); - - if ($sall) - { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . implode(', ',$fieldstosearchall); + if (! empty($obj->fk_soc)) { + $memberstatic->fetch_thirdparty(); + $companyname=$memberstatic->thirdparty->name; + } else { + $companyname=$obj->company; } - // Filter on categories - $moreforfilter=''; - if (! empty($conf->categorie->enabled)) - { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1); - $moreforfilter.='
'; - } - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; - else $moreforfilter = $hookmanager->resPrint; - if (! empty($moreforfilter)) - { - print '
'; - print $moreforfilter; - print '
'; - } - - $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; - $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $var=!$var; + print ""; - print '
'.$langs->trans("NumberingShort").'
 '; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $listetype=$membertypestatic->liste_array(); + print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $form->select_country($search_country,'search_country','',0,'maxwidth100'); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + print ''; + print ''; + print ''; + $liststatus=array( + '-1'=>$langs->trans("Draft"), + '1'=>$langs->trans("Validated"), + '0'=>$langs->trans("Resiliated") + ); + print $form->selectarray('statut', $liststatus, $statut, -2); + print ''; +$searchpitco=$form->showFilterAndCheckAddButtons(0); +print $searchpitco; +print '
'."\n"; - print ''; if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; + print ''; } - if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'],$_SERVER["PHP_SELF"],'t.libelle','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$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; - if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'],$_SERVER["PHP_SELF"],"d.statut","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - // Line for filters fields - print ''; - - // Line numbering - if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) - { - print ''; - } - // Ref if (! empty($arrayfields['d.ref']['checked'])) { - print ''; - } - + print "\n"; + } + // Firstname if (! empty($arrayfields['d.firstname']['checked'])) { - print ''; + print "\n"; } - + // Lastname if (! empty($arrayfields['d.lastname']['checked'])) { - print ''; + print "\n"; } - + // Company if (! empty($arrayfields['d.company']['checked'])) { - print ''; + print "\n"; } - + // Login if (! empty($arrayfields['d.login']['checked'])) { - print ''; + print "\n"; } - - if (! empty($arrayfields['d.morphy']['checked'])) + // Moral/Physique + if (! empty($arrayfields['d.morphy']['checked'])) { - print ''; + print "\n"; } - + // Type label if (! empty($arrayfields['t.libelle']['checked'])) { - print ''; } - - if (! empty($arrayfields['d.address']['checked'])) + // Address + if (! empty($arrayfields['d.address']['checked'])) { - print ''; + print ''; } - - if (! empty($arrayfields['d.zip']['checked'])) + // Zip + if (! empty($arrayfields['d.zip']['checked'])) { - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } - if (! empty($arrayfields['d.town']['checked'])) + // Town + if (! empty($arrayfields['d.town']['checked'])) { - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } // State if (! empty($arrayfields['state.nom']['checked'])) { - print ''; + print "\n"; + if (! $i) $totalarray['nbfield']++; } // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } // Phone pro if (! empty($arrayfields['d.phone']['checked'])) { - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } // Phone perso if (! empty($arrayfields['d.phone_perso']['checked'])) { - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } // Phone mobile if (! empty($arrayfields['d.phone_mobile']['checked'])) { - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } - // Email - if (! empty($arrayfields['d.email']['checked'])) + // EMail + if (! empty($arrayfields['d.email']['checked'])) { - print ''; + print "\n"; } - - if (! empty($arrayfields['d.datefin']['checked'])) + // End of subscription date + $datefin=$db->jdate($obj->datefin); + if (! empty($arrayfields['d.datefin']['checked'])) { - print ''; + if ($datefin) + { + print ''; + } + else + { + print ''; + } } // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -524,315 +774,78 @@ if ($resql) { if (! empty($arrayfields["ef.".$key]['checked'])) { + print 'getAlignFlag($key); - $typeofextrafield=$extrafields->attribute_type[$key]; - print ''; + if (! $i) $totalarray['nbfield']++; } } } // Fields from hook - $parameters=array('arrayfields'=>$arrayfields); - $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by 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['d.datec']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } // Date modification if (! empty($arrayfields['d.tms']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } // Status if (! empty($arrayfields['d.statut']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } // Action column - print ''; - - print "\n"; - - $var=True; - while ($i < $num && $i < $conf->liste_limit) + print '"; - - if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) - { - print ''; - } - - // Ref - if (! empty($arrayfields['d.ref']['checked'])) - { - print "\n"; - } - // Firstname - if (! empty($arrayfields['d.firstname']['checked'])) - { - print "\n"; - } - // Lastname - if (! empty($arrayfields['d.lastname']['checked'])) - { - print "\n"; - } - // Company - if (! empty($arrayfields['d.company']['checked'])) - { - print "\n"; - } - // Login - if (! empty($arrayfields['d.login']['checked'])) - { - print "\n"; - } - // Moral/Physique - if (! empty($arrayfields['d.morphy']['checked'])) - { - print "\n"; - } - // Type label - if (! empty($arrayfields['t.libelle']['checked'])) - { - $membertypestatic->id=$obj->type_id; - $membertypestatic->libelle=$obj->type; - print ''; - } - // Address - if (! empty($arrayfields['d.address']['checked'])) - { - print ''; - } - // Zip - if (! empty($arrayfields['d.zip']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Town - if (! empty($arrayfields['d.town']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // State - if (! empty($arrayfields['state.nom']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - // Country - if (! empty($arrayfields['country.code_iso']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Phone pro - if (! empty($arrayfields['d.phone']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Phone perso - if (! empty($arrayfields['d.phone_perso']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Phone mobile - if (! empty($arrayfields['d.phone_mobile']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // EMail - if (! empty($arrayfields['d.email']['checked'])) - { - print "\n"; - } - // End of subscription date - $datefin=$db->jdate($obj->datefin); - if (! empty($arrayfields['d.datefin']['checked'])) - { - if ($datefin) - { - print ''; - } - else - { - 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 ''; - if (! $i) $totalarray['nbfield']++; - } - } - } - // 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['d.datec']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Date modification - if (! empty($arrayfields['d.tms']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Status - if (! empty($arrayfields['d.statut']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Action column - print '"; - if (! $i) $totalarray['nbfield']++; - - print "\n"; - $i++; + print "rowid."&action=edit&backtopage=1\">".img_edit().""; } - - $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("NumberingShort").''.($i+1).'
 '; - print ''; - print '"; + print $memberstatic->getNomUrl(1); + print "'; - print '"; + print $obj->firstname; + print "'; - print '"; + print $obj->lastname; + print "'; - print '"; + print $companyname; + print "'; - print '".$obj->login."'; - print '".$memberstatic->getmorphylib($obj->morphy)."'; - $listetype=$membertypestatic->liste_array(); - print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32); + $membertypestatic->id=$obj->type_id; + $membertypestatic->libelle=$obj->type; + print ''; + print $membertypestatic->getNomUrl(1,32); print ''; - print ''; + print $obj->address; + print ''; - print ''; + print $obj->zip; + print ''; - print ''; + print $obj->town; + print ''; - print ''; - print '".$obj->state_name."'; - print $form->select_country($search_country,'search_country','',0,'maxwidth100'); + print ''; + $tmparray=getCountry($obj->country,'all'); + print $tmparray['label']; print ''; - print ''; + print $obj->phone; + print ''; - print ''; + print $obj->phone_perso; + print ''; - print ''; + print $obj->phone_mobile; + print ''; - print '".dol_print_email($obj->email,0,0,1)."'; - print ''; + print dol_print_date($datefin,'day'); + if ($memberstatic->hasDelay()) { + print " ".img_warning($langs->trans("SubscriptionLate")); + } + print ''; + if ($obj->subscription == 'yes') + { + print $langs->trans("SubscriptionNotReceived"); + if ($obj->statut > 0) print " ".img_warning(); + } + else + { + print ' '; + } + print ''; - if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) - { - $crit=$val; - $tmpkey=preg_replace('/search_options_/','',$key); - $searchclass=''; - if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; - if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; - print ''; - } + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print ''; + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); print ''; + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''; - $liststatus=array( - '-1'=>$langs->trans("Draft"), - '1'=>$langs->trans("Validated"), - '0'=>$langs->trans("Resiliated") - ); - print $form->selectarray('statut', $liststatus, $statut, -2); + print ''; + print $memberstatic->LibStatut($obj->statut,$obj->subscription,$datefin,2); print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - print '
'; + if ($user->rights->adherent->creer) { - $obj = $db->fetch_object($resql); - - $datefin=$db->jdate($obj->datefin); - $memberstatic->id=$obj->rowid; - $memberstatic->ref=$obj->rowid; - $memberstatic->lastname=$obj->lastname; - $memberstatic->firstname=$obj->firstname; - $memberstatic->societe=$obj->company; - $memberstatic->statut=$obj->statut; - $memberstatic->datefin= $datefin; - $memberstatic->socid = $obj->fk_soc; - - if (! empty($obj->fk_soc)) { - $memberstatic->fetch_thirdparty(); - $companyname=$memberstatic->thirdparty->name; - } else { - $companyname=$obj->company; - } - - $var=!$var; - print "
'.($i+1).'"; - print $memberstatic->getNomUrl(1); - print ""; - print $obj->firstname; - print ""; - print $obj->lastname; - print ""; - print $companyname; - print "".$obj->login."".$memberstatic->getmorphylib($obj->morphy)."'; - print $membertypestatic->getNomUrl(1,32); - print ''; - print $obj->address; - print ''; - print $obj->zip; - print ''; - print $obj->town; - print '".$obj->state_name."'; - $tmparray=getCountry($obj->country,'all'); - print $tmparray['label']; - print ''; - print $obj->phone; - print ''; - print $obj->phone_perso; - print ''; - print $obj->phone_mobile; - print '".dol_print_email($obj->email,0,0,1)."'; - print dol_print_date($datefin,'day'); - if ($memberstatic->hasDelay()) { - print " ".img_warning($langs->trans("SubscriptionLate")); - } - print ''; - if ($obj->subscription == 'yes') - { - print $langs->trans("SubscriptionNotReceived"); - if ($obj->statut > 0) print " ".img_warning(); - } - else - { - print ' '; - } - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour'); - print ''; - print $memberstatic->LibStatut($obj->statut,$obj->subscription,$datefin,2); - print ''; - if ($user->rights->adherent->creer) - { - print "rowid."&action=edit&backtopage=1\">".img_edit().""; - } - print ' '; - if ($user->rights->adherent->supprimer && $obj->statut == -1) - { - print "rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png').""; - } - if ($user->rights->adherent->supprimer && $obj->statut == 1) - { - print "rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png').""; - } - print "
\n"; - print '
'; - - if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit, 1); -} -else -{ - dol_print_error($db); + print ' '; + if ($user->rights->adherent->supprimer && $obj->statut == -1) + { + print "rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png').""; + } + if ($user->rights->adherent->supprimer && $obj->statut == 1) + { + print "rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png').""; + } + print ""; + if (! $i) $totalarray['nbfield']++; + + print "\n"; + $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 "\n"; +print ''; + +if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit, 1); + llxFooter(); - $db->close(); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index bc8c3235242..7b2e5528eb6 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -385,7 +385,7 @@ if (! $result) $num = $db->num_rows($result); -if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { $obj = $db->fetch_object($resql); $id = $obj->cidp; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 671e6db3af3..3e2f21e4ecd 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -170,26 +170,38 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab } - + /* * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - $sall=""; - $sref=""; - $snom=""; - $sbarcode=""; - $search_categ=0; - $tosell=""; - $tobuy=""; - $search_tobatch=''; - $search_accountancy_code_sell=''; - $search_accountancy_code_buy=''; - $search_array_options=array(); + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + { + $sall=""; + $sref=""; + $snom=""; + $sbarcode=""; + $search_categ=0; + $tosell=""; + $tobuy=""; + $search_tobatch=''; + $search_accountancy_code_sell=''; + $search_accountancy_code_buy=''; + $search_array_options=array(); + } } @@ -305,13 +317,12 @@ else { $num = $db->num_rows($resql); - $i = 0; - - if ($num == 1 && ($sall || $snom || $sref || $sbarcode) && $action != 'list') + if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { - $objp = $db->fetch_object($resql); - header("Location: card.php?id=".$objp->rowid); - exit; + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/product/card.php?id='.$id); + exit; } $helpurl=''; @@ -585,6 +596,7 @@ else $product_fourn =new ProductFournisseur($db); $var=true; + $i = 0; while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 56da78cdbcf..787d902768d 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -142,34 +142,44 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; } -// Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - $search_all=''; - $search_categ=''; - $search_ref=""; - $search_label=""; - $search_societe=""; - $search_year=""; - $search_status=-1; - $search_opp_status=-1; - $search_opp_amount=''; - $search_opp_percent=''; - $search_budget_amount=''; - $search_public=""; - $search_sale=""; - $search_user=''; - $sday=""; - $smonth=""; - $syear=""; - $day=""; - $month=""; - $year=""; - $search_array_options=array(); -} + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers + { + $search_all=''; + $search_categ=''; + $search_ref=""; + $search_label=""; + $search_societe=""; + $search_year=""; + $search_status=-1; + $search_opp_status=-1; + $search_opp_amount=''; + $search_opp_percent=''; + $search_budget_amount=''; + $search_public=""; + $search_sale=""; + $search_user=''; + $sday=""; + $smonth=""; + $syear=""; + $day=""; + $month=""; + $year=""; + $search_array_options=array(); + } +} /* @@ -185,8 +195,6 @@ $formproject = new FormProjets($db); $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"); - // 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); @@ -320,538 +328,546 @@ $sql.= $db->plimit($limit + 1,$offset); dol_syslog("list allowed project", LOG_DEBUG); //print $sql; $resql = $db->query($sql); -if ($resql) +if (! $resql) { - $var=true; - $num = $db->num_rows($resql); - - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - 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_ref != '') $param.='&search_ref='.$search_ref; - if ($search_label != '') $param.='&search_label='.$search_label; - if ($search_societe != '') $param.='&search_societe='.$search_societe; - if ($search_status >= 0) $param.='&search_status='.$search_status; - if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','openedopp','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); - if ((is_numeric($search_opp_percent) && $search_opp_percent >= 0) || in_array($search_opp_percent, array('all','openedopp','none'))) $param.='&search_opp_percent='.urlencode($search_opp_percent); - if ($search_public != '') $param.='&search_public='.$search_public; - if ($search_user > 0) $param.='&search_user='.$search_user; - if ($search_sale > 0) $param.='&search_sale='.$search_sale; - if ($search_opp_amount != '') $param.='&search_opp_amount='.$search_opp_amount; - if ($search_budget_amount != '') $param.='&search_budget_amount='.$search_budget_amount; - 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); - } - - $text=$langs->trans("Projects"); - if ($search_user == $user->id) $text=$langs->trans('MyProjects'); - - print '
'; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit); - - // Show description of content - if ($search_user == $user->id) print $langs->trans("MyProjectsDesc").'

'; - 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); - } - - $moreforfilter=''; - - // Filter on categories - if (! empty($conf->categorie->enabled)) - { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$formother->select_categories('project',$search_categ,'search_categ',1); - $moreforfilter.='
'; - } - - // If the user can view user other than himself - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; - $includeonly=''; - if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); - $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); - $moreforfilter.='
'; - - // If the user can view thirdparties other than his' - if ($user->rights->societe->client->voir || $socid) - { - $langs->load("commercial"); - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; - $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, '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 ''; - 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); - if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'],$_SERVER["PHP_SELF"],'p.opp_percent',"",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'],$_SERVER["PHP_SELF"],'p.budget_amount',"",$param,'align="right"',$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; - 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="right"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - - print ''; - if (! empty($arrayfields['p.ref']['checked'])) - { - print ''; - } - if (! empty($arrayfields['p.title']['checked'])) - { - print ''; - } - if (! empty($arrayfields['s.nom']['checked'])) - { - print ''; - } - // Sale representative - if (! empty($arrayfields['commercial']['checked'])) - { - print ''; - } - // Start date - if (! empty($arrayfields['p.dateo']['checked'])) - { - print ''; - } - // End date - if (! empty($arrayfields['p.datee']['checked'])) - { - print ''; - } - if (! empty($arrayfields['p.public']['checked'])) - { - print ''; - } - if (! empty($arrayfields['p.opp_amount']['checked'])) - { - print ''; - } - if (! empty($arrayfields['p.fk_opp_status']['checked'])) - { - print ''; - } - if (! empty($arrayfields['p.opp_percent']['checked'])) - { - print ''; - } - if (! empty($arrayfields['p.budget_amount']['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'])) - { - $align=$extrafields->getAlignFlag($key); - $typeofextrafield=$extrafields->attribute_type[$key]; - 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['p.datec']['checked'])) - { - // Date creation - print ''; - } - if (! empty($arrayfields['p.tms']['checked'])) - { - // Date modification - print ''; - } - if (! empty($arrayfields['p.fk_statut']['checked'])) - { - print ''; - } - // Action column - print ''; - - print ''."\n"; - - $i=0; - $var=true; - $totalarray=array(); - 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; - $projectstatic->ref = $obj->ref; - $projectstatic->datee = $obj->date_end; - $projectstatic->statut = $obj->fk_statut; - $projectstatic->opp_status = $obj->fk_opp_status; - - $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? - if ($userAccess >= 0) - { - $var=!$var; - print ""; - - // Project url - if (! empty($arrayfields['p.ref']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Title - if (! empty($arrayfields['p.title']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Company - if (! empty($arrayfields['s.nom']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Sales Representatives - if (! empty($arrayfields['commercial']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Date start - if (! empty($arrayfields['p.dateo']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Date end - if (! empty($arrayfields['p.datee']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Visibility - if (! empty($arrayfields['p.public']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Amount - if (! empty($arrayfields['p.opp_amount']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totaloppfield']=$totalarray['nbfield']; - } - if (! empty($arrayfields['p.fk_opp_status']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['p.opp_percent']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['p.budget_amount']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalbudgetfield']=$totalarray['nbfield']; - } - // 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 ''; - } - } - if (! $i) $totalarray['nbfield']++; - } - // 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['p.datec']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Date modification - if (! empty($arrayfields['p.tms']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Status - if (! empty($arrayfields['p.fk_statut']['checked'])) - { - $projectstatic->statut = $obj->fk_statut; - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Action column - print ''; - if (! $i) $totalarray['nbfield']++; - - print "\n"; - - } - - $i++; - - } - - // Show total line - if (isset($totalarray['totaloppfield']) || isset($totalarray['totalbudgetfield'])) - { - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if ($i == 1) - { - if ($num < $limit) print ''; - else print ''; - } - elseif ($totalarray['totaloppfield'] == $i) print ''; - elseif ($totalarray['totalbudgetfield'] == $i) print ''; - else print ''; - } - print ''; - } - - $db->free($resql); - - $parameters=array('sql' => $sql); - $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print "
'; - print ''; - print ''; - 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 ''; - $array=array(''=>'',0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject")); - print $form->selectarray('search_public',$array,$search_public); - print ''; - print ''; - print ''; - print $formproject->selectOpportunityStatus('search_opp_status',$search_opp_status,1,1,1); - print ''; - print ''; - print ''; - print ''; - print ''; - if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) - { - $crit=$val; - $tmpkey=preg_replace('/search_options_/','',$key); - $searchclass=''; - if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; - if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; - print ''; - } - print ''; - print ''; - print ''; - $arrayofstatus = array(); - foreach($projectstatic->statuts_short as $key => $val) $arrayofstatus[$key]=$langs->trans($val); - $arrayofstatus['99']=$langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')'; - print $form->selectarray('search_status', $arrayofstatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); - print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - print '
'; - print $projectstatic->getNomUrl(1); - if ($projectstatic->hasDelay()) print img_warning($langs->trans('Late')); - print ''; - print dol_trunc($obj->title,80); - print ''; - if ($obj->socid) - { - $socstatic->id=$obj->socid; - $socstatic->name=$obj->name; - print $socstatic->getNomUrl(1); - } - else - { - print ' '; - } - print ''; - if ($obj->socid) - { - $socstatic->id=$obj->socid; - $socstatic->name=$obj->name; - $listsalesrepresentatives=$socstatic->getSalesRepresentatives($user); - $nbofsalesrepresentative=count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 3) // We print only number - { - print ''; - print $nbofsalesrepresentative; - print ''; - } - else if ($nbofsalesrepresentative > 0) - { - $userstatic=new User($db); - $j=0; - foreach($listsalesrepresentatives as $val) - { - $userstatic->id=$val['id']; - $userstatic->lastname=$val['lastname']; - $userstatic->firstname=$val['firstname']; - $userstatic->email=$val['email']; - $userstatic->statut=$val['statut']; - $userstatic->entity=$val['entity']; - print $userstatic->getNomUrl(1); - $j++; - if ($j < $nbofsalesrepresentative) print ', '; - } - } - //else print $langs->trans("NoSalesRepresentativeAffected"); - } - else - { - print ' '; - } - print ''; - print dol_print_date($db->jdate($obj->date_start),'day'); - print ''; - print dol_print_date($db->jdate($obj->date_end),'day'); - print ''; - if ($obj->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print ''; - if ($obj->opp_status_code) - { - print price($obj->opp_amount, 1, '', 1, -1, -1, ''); - $totalarray['totalopp'] += $obj->opp_amount; - } - print ''; - if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code); - print ''; - if ($obj->opp_percent) print price($obj->opp_percent, 1, '', 1, 0).'%'; - print ''; - if ($obj->budget_amount != '') - { - print price($obj->budget_amount, 1, '', 1, -1, -1); - $totalarray['totalbudget'] += $obj->budget_amount; - } - 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).''; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - { - $selected=0; - if (in_array($obj->rowid, $arrayofselected)) $selected=1; - print ''; - } - print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalopp']).''.price($totalarray['totalbudget']).'
\n"; - print "
\n"; + dol_print_error($db); + exit; } + +$var=true; +$num = $db->num_rows($resql); + +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) +{ + $obj = $db->fetch_object($resql); + $id = $obj->projectid; + header("Location: ".DOL_URL_ROOT.'/projet/card.php?id='.$id); + exit; +} + +llxHeader("",$title,"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +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_ref != '') $param.='&search_ref='.$search_ref; +if ($search_label != '') $param.='&search_label='.$search_label; +if ($search_societe != '') $param.='&search_societe='.$search_societe; +if ($search_status >= 0) $param.='&search_status='.$search_status; +if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','openedopp','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); +if ((is_numeric($search_opp_percent) && $search_opp_percent >= 0) || in_array($search_opp_percent, array('all','openedopp','none'))) $param.='&search_opp_percent='.urlencode($search_opp_percent); +if ($search_public != '') $param.='&search_public='.$search_public; +if ($search_user > 0) $param.='&search_user='.$search_user; +if ($search_sale > 0) $param.='&search_sale='.$search_sale; +if ($search_opp_amount != '') $param.='&search_opp_amount='.$search_opp_amount; +if ($search_budget_amount != '') $param.='&search_budget_amount='.$search_budget_amount; +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); +} + +$text=$langs->trans("Projects"); +if ($search_user == $user->id) $text=$langs->trans('MyProjects'); + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit); + +// Show description of content +if ($search_user == $user->id) print $langs->trans("MyProjectsDesc").'

'; else { - dol_print_error($db); + 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); +} + +$moreforfilter=''; + +// Filter on categories +if (! empty($conf->categorie->enabled)) +{ + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('Categories'). ': '; + $moreforfilter.=$formother->select_categories('project',$search_categ,'search_categ',1); + $moreforfilter.='
'; +} + +// If the user can view user other than himself +$moreforfilter.='
'; +$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; +$includeonly=''; +if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); +$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); +$moreforfilter.='
'; + +// If the user can view thirdparties other than his' +if ($user->rights->societe->client->voir || $socid) +{ + $langs->load("commercial"); + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; + $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, '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 ''; +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); +if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'],$_SERVER["PHP_SELF"],'p.opp_percent',"",$param,'align="right"',$sortfield,$sortorder); +if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'],$_SERVER["PHP_SELF"],'p.budget_amount',"",$param,'align="right"',$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; +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="right"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + +print ''; +if (! empty($arrayfields['p.ref']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.title']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['s.nom']['checked'])) +{ + print ''; +} +// Sale representative +if (! empty($arrayfields['commercial']['checked'])) +{ + print ''; +} +// Start date +if (! empty($arrayfields['p.dateo']['checked'])) +{ + print ''; +} +// End date +if (! empty($arrayfields['p.datee']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.public']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.opp_amount']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.fk_opp_status']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.opp_percent']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['p.budget_amount']['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'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + 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['p.datec']['checked'])) +{ + // Date creation + print ''; +} +if (! empty($arrayfields['p.tms']['checked'])) +{ + // Date modification + print ''; +} +if (! empty($arrayfields['p.fk_statut']['checked'])) +{ + print ''; +} +// Action column +print ''; + +print ''."\n"; + +$i=0; +$var=true; +$totalarray=array(); +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; + $projectstatic->ref = $obj->ref; + $projectstatic->datee = $obj->date_end; + $projectstatic->statut = $obj->fk_statut; + $projectstatic->opp_status = $obj->fk_opp_status; + + $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? + if ($userAccess >= 0) + { + $var=!$var; + print ""; + + // Project url + if (! empty($arrayfields['p.ref']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Title + if (! empty($arrayfields['p.title']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Company + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Sales Representatives + if (! empty($arrayfields['commercial']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date start + if (! empty($arrayfields['p.dateo']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date end + if (! empty($arrayfields['p.datee']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Visibility + if (! empty($arrayfields['p.public']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Amount + if (! empty($arrayfields['p.opp_amount']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaloppfield']=$totalarray['nbfield']; + } + if (! empty($arrayfields['p.fk_opp_status']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['p.opp_percent']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['p.budget_amount']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalbudgetfield']=$totalarray['nbfield']; + } + // 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 ''; + } + } + if (! $i) $totalarray['nbfield']++; + } + // 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['p.datec']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['p.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + if (! empty($arrayfields['p.fk_statut']['checked'])) + { + $projectstatic->statut = $obj->fk_statut; + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print "\n"; + + } + + $i++; + +} + +// Show total line +if (isset($totalarray['totaloppfield']) || isset($totalarray['totalbudgetfield'])) +{ + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totaloppfield'] == $i) print ''; + elseif ($totalarray['totalbudgetfield'] == $i) print ''; + else print ''; + } + print ''; +} + +$db->free($resql); + +$parameters=array('sql' => $sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print "
'; + print ''; + print ''; + 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 ''; + $array=array(''=>'',0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject")); + print $form->selectarray('search_public',$array,$search_public); + print ''; + print ''; + print ''; + print $formproject->selectOpportunityStatus('search_opp_status',$search_opp_status,1,1,1); + print ''; + print ''; + print ''; + print ''; + print ''; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + print ''; + print ''; + print ''; + $arrayofstatus = array(); + foreach($projectstatic->statuts_short as $key => $val) $arrayofstatus[$key]=$langs->trans($val); + $arrayofstatus['99']=$langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')'; + print $form->selectarray('search_status', $arrayofstatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); + print ''; +$searchpitco=$form->showFilterAndCheckAddButtons(0); +print $searchpitco; +print '
'; + print $projectstatic->getNomUrl(1); + if ($projectstatic->hasDelay()) print img_warning($langs->trans('Late')); + print ''; + print dol_trunc($obj->title,80); + print ''; + if ($obj->socid) + { + $socstatic->id=$obj->socid; + $socstatic->name=$obj->name; + print $socstatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; + if ($obj->socid) + { + $socstatic->id=$obj->socid; + $socstatic->name=$obj->name; + $listsalesrepresentatives=$socstatic->getSalesRepresentatives($user); + $nbofsalesrepresentative=count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 3) // We print only number + { + print ''; + print $nbofsalesrepresentative; + print ''; + } + else if ($nbofsalesrepresentative > 0) + { + $userstatic=new User($db); + $j=0; + foreach($listsalesrepresentatives as $val) + { + $userstatic->id=$val['id']; + $userstatic->lastname=$val['lastname']; + $userstatic->firstname=$val['firstname']; + $userstatic->email=$val['email']; + $userstatic->statut=$val['statut']; + $userstatic->entity=$val['entity']; + print $userstatic->getNomUrl(1); + $j++; + if ($j < $nbofsalesrepresentative) print ', '; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } + else + { + print ' '; + } + print ''; + print dol_print_date($db->jdate($obj->date_start),'day'); + print ''; + print dol_print_date($db->jdate($obj->date_end),'day'); + print ''; + if ($obj->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print ''; + if ($obj->opp_status_code) + { + print price($obj->opp_amount, 1, '', 1, -1, -1, ''); + $totalarray['totalopp'] += $obj->opp_amount; + } + print ''; + if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code); + print ''; + if ($obj->opp_percent) print price($obj->opp_percent, 1, '', 1, 0).'%'; + print ''; + if ($obj->budget_amount != '') + { + print price($obj->budget_amount, 1, '', 1, -1, -1); + $totalarray['totalbudget'] += $obj->budget_amount; + } + 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).''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalopp']).''.price($totalarray['totalbudget']).'
\n"; +print "
\n"; llxFooter(); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index f5b422a7ce2..1179ca7546e 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -129,29 +129,41 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; } -// Purge criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - $search_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=''; - $search_array_options=array(); + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // 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=''; + $search_array_options=array(); + } } + if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1; @@ -174,8 +186,6 @@ if ($search_task_user > 0) $tuser->fetch($search_task_user); $title=$langs->trans("Activities"); if ($search_task_user == $user->id) $title=$langs->trans("MyActivities"); -llxHeader("",$title,"Projet"); - if ($id) { $projectstatic->fetch($id); @@ -311,506 +321,513 @@ $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); - - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - 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 '
'; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit); - - // 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("TasksOnProjectsDesc").'

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

'; - } - - 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 ''; - 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['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.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; - 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 ''; - 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['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.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'])) - { - $align=$extrafields->getAlignFlag($key); - $typeofextrafield=$extrafields->attribute_type[$key]; - 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 ''; - - - $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; - - $now = dol_now(); - $i=0; - $var=true; - $totalarray=array(); - while ($i < min($num,$limit)) - { - $obj = $db->fetch_object($resql); - - $projectstatic->id = $obj->projectid; - $projectstatic->ref = $obj->projectref; - $projectstatic->title = $obj->projecttitle; - $projectstatic->public = $obj->public; - $projectstatic->statut = $obj->projectstatus; - $projectstatic->datee = $db->jdate($obj->projectdatee); - - $taskstatic->id = $obj->id; - $taskstatic->ref = $obj->ref; - $taskstatic->label = $obj->label; - $taskstatic->fk_statut = $obj->fk_statut; - $taskstatic->progress = $obj->progress; - $taskstatic->datee = $db->jdate($obj->date_end); // deprecated - $taskstatic->date_end = $db->jdate($obj->date_end); - - $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? - if ($userAccess >= 0) - { - $var=!$var; - print ""; - - // Ref - if (! empty($arrayfields['t.ref']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Label - if (! empty($arrayfields['t.label']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Date start - if (! empty($arrayfields['t.dateo']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Date end - if (! empty($arrayfields['t.datee']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Project ref - if (! empty($arrayfields['p.ref']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Project title - if (! empty($arrayfields['p.title']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Third party - if (! empty($arrayfields['s.nom']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Project status - if (! empty($arrayfields['p.fk_statut']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Planned workload - if (! empty($arrayfields['t.planned_workload']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalplannedworkloadfield']=$totalarray['nbfield']; - $totalarray['totalplannedworkload'] += $obj->planned_workload; - } - // Time spent - if (! empty($arrayfields['t.duration_effective']['checked'])) - { - $showlineingray=0;$showproject=1; - print ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totaldurationeffectivefield']=$totalarray['nbfield']; - $totalarray['totaldurationeffective'] += $obj->duration_effective; - } - // Calculated progress - if (! empty($arrayfields['t.progress_calculated']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Declared progress - if (! empty($arrayfields['t.progress']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // 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 ''; - if (! $i) $totalarray['nbfield']++; - } - } - } - // 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 ''; - if (! $i) $totalarray['nbfield']++; - } - // Date modification - if (! empty($arrayfields['t.tms']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Status - /*if (! empty($arrayfields['p.fk_statut']['checked'])) - { - $projectstatic->statut = $obj->fk_statut; - print ''; - }*/ - // Action column - print ''; - if (! $i) $totalarray['nbfield']++; - - print "\n"; - - //print projectLinesa(); - } - - $i++; - } - - // Show total line - if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield'])) - { - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if ($i == 1) - { - if ($num < $limit) print ''; - else print ''; - } - elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''; - elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''; - else print ''; - } - print ''; - } - - $db->free($resql); - - $parameters=array('sql' => $sql); - $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print "
'; - print ''; - print ''; - 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 ''; - $arrayofstatus = array(); - foreach($projectstatic->statuts_short as $key => $val) $arrayofstatus[$key]=$langs->trans($val); - $arrayofstatus['99']=$langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')'; - print $form->selectarray('search_projectstatus', $arrayofstatus, $search_projectstatus, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); - print ''; - if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) - { - $crit=$val; - $tmpkey=preg_replace('/search_options_/','',$key); - $searchclass=''; - if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; - if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; - print ''; - } - print ''; - print ''; - print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - print '
'; - print $taskstatic->getNomUrl(1,'withproject'); - if ($taskstatic->hasDelay()) print img_warning("Late"); - 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 ''; - print $projectstatic->getNomUrl(1, 'task'); - if ($projectstatic->hasDelay()) print img_warning("Late"); - 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 ''; - $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).''; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - { - $selected=0; - if (in_array($obj->rowid, $arrayofselected)) $selected=1; - print ''; - } - print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalplannedworkload'],$plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totaldurationeffective'],$timespentoutputformat).'
"; - - print '
'; -} -else +if (! $resql) { dol_print_error($db); + exit; } +$var=true; +$num = $db->num_rows($resql); + +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) +{ + $obj = $db->fetch_object($resql); + $id = $obj->id; + header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1'); + exit; +} + +llxHeader("",$title,"Projet"); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +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 '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit); + +// 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("TasksOnProjectsDesc").'

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

'; +} + +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 ''; +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['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.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; +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 ''; +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['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.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'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + 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 ''; + + +$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; + +$now = dol_now(); +$i=0; +$var=true; +$totalarray=array(); +while ($i < min($num,$limit)) +{ + $obj = $db->fetch_object($resql); + + $projectstatic->id = $obj->projectid; + $projectstatic->ref = $obj->projectref; + $projectstatic->title = $obj->projecttitle; + $projectstatic->public = $obj->public; + $projectstatic->statut = $obj->projectstatus; + $projectstatic->datee = $db->jdate($obj->projectdatee); + + $taskstatic->id = $obj->id; + $taskstatic->ref = $obj->ref; + $taskstatic->label = $obj->label; + $taskstatic->fk_statut = $obj->fk_statut; + $taskstatic->progress = $obj->progress; + $taskstatic->datee = $db->jdate($obj->date_end); // deprecated + $taskstatic->date_end = $db->jdate($obj->date_end); + + $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? + if ($userAccess >= 0) + { + $var=!$var; + print ""; + + // Ref + if (! empty($arrayfields['t.ref']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Label + if (! empty($arrayfields['t.label']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date start + if (! empty($arrayfields['t.dateo']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date end + if (! empty($arrayfields['t.datee']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Project ref + if (! empty($arrayfields['p.ref']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Project title + if (! empty($arrayfields['p.title']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Third party + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Project status + if (! empty($arrayfields['p.fk_statut']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Planned workload + if (! empty($arrayfields['t.planned_workload']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalplannedworkloadfield']=$totalarray['nbfield']; + $totalarray['totalplannedworkload'] += $obj->planned_workload; + } + // Time spent + if (! empty($arrayfields['t.duration_effective']['checked'])) + { + $showlineingray=0;$showproject=1; + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaldurationeffectivefield']=$totalarray['nbfield']; + $totalarray['totaldurationeffective'] += $obj->duration_effective; + } + // Calculated progress + if (! empty($arrayfields['t.progress_calculated']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Declared progress + if (! empty($arrayfields['t.progress']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // 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 ''; + if (! $i) $totalarray['nbfield']++; + } + } + } + // 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 ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['t.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + /*if (! empty($arrayfields['p.fk_statut']['checked'])) + { + $projectstatic->statut = $obj->fk_statut; + print ''; + }*/ + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print "\n"; + + //print projectLinesa(); + } + + $i++; +} + +// Show total line +if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield'])) +{ + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''; + elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''; + else print ''; + } + print ''; +} + +$db->free($resql); + +$parameters=array('sql' => $sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print "
'; + print ''; + print ''; + 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 ''; + $arrayofstatus = array(); + foreach($projectstatic->statuts_short as $key => $val) $arrayofstatus[$key]=$langs->trans($val); + $arrayofstatus['99']=$langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')'; + print $form->selectarray('search_projectstatus', $arrayofstatus, $search_projectstatus, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); + print ''; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + print ''; + print ''; + print ''; +$searchpitco=$form->showFilterAndCheckAddButtons(0); +print $searchpitco; +print '
'; + print $taskstatic->getNomUrl(1,'withproject'); + if ($taskstatic->hasDelay()) print img_warning("Late"); + 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 ''; + print $projectstatic->getNomUrl(1, 'task'); + if ($projectstatic->hasDelay()) print img_warning("Late"); + 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 ''; + $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).''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalplannedworkload'],$plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totaldurationeffective'],$timespentoutputformat).'
"; + +print '
'; llxFooter(); - $db->close(); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 96c527f3976..6acae492c33 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -444,7 +444,7 @@ if (! $resql) $num = $db->num_rows($resql); -if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && $action != 'list') { $obj = $db->fetch_object($resql); $id = $obj->rowid; diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 459a89e573b..f5d9407d2e3 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -134,40 +134,46 @@ if ($mode == 'employee') $search_employee=1; /* * Actions */ - + +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; } + $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (empty($reshook)) { - $search_user=""; - $search_login=""; - $search_lastname=""; - $search_firstname=""; - $search_gender=""; - $search_employee=""; - $search_accountancy_code=""; - $search_email=""; - $search_statut=""; - $search_thirdparty=""; - $search_supervisor=""; - $search_datelastlogin=""; - $search_datepreviouslogin=""; - $search_date_creation=""; - $search_date_update=""; - $search_array_options=array(); + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers + { + $search_user=""; + $search_login=""; + $search_lastname=""; + $search_firstname=""; + $search_gender=""; + $search_employee=""; + $search_accountancy_code=""; + $search_email=""; + $search_statut=""; + $search_thirdparty=""; + $search_supervisor=""; + $search_datelastlogin=""; + $search_datepreviouslogin=""; + $search_date_creation=""; + $search_date_update=""; + $search_array_options=array(); + } } - /* * View */ -llxHeader('',$langs->trans("ListOfUsers")); $buttonviewhierarchy='
'; @@ -239,150 +245,363 @@ if ($result) $sql.= $db->plimit($limit+1, $offset); $result = $db->query($sql); -if ($result) +if (! $result) { - $num = $db->num_rows($result); - $i = 0; + dol_print_error($db); + exit; +} - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($sall != '') $param.='&sall='.urlencode($sall); - if ($search_user != '') $param.="&search_user=".$search_user; - if ($search_login != '') $param.="&search_login=".$search_login; - if ($search_lastname != '') $param.="&search_lastname=".$search_lastname; - if ($search_firstname != '') $param.="&search_firstname=".$search_firstname; - if ($search_gender != '') $param.="&search_gender=".$search_gender; - if ($search_employee != '') $param.="&search_employee=".$search_employee; - if ($search_accountancy_code != '') $param.="&search_accountancy_code=".$search_accountancy_code; - if ($search_email != '') $param.="&search_email=".$search_email; - if ($search_supervisor > 0) $param.="&search_supervisor=".$search_supervisor; - if ($search_statut != '') $param.="&search_statut=".$search_statut; - if ($optioncss != '') $param.='&optioncss='.$optioncss; - if ($mode != '') $param.='&mode='.$mode; - // 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); - } - - $text = $langs->trans("ListOfUsers"); - - print '
'."\n"; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); +$num = $db->num_rows($result); - if ($sall) - { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); - } - - $moreforfilter=''; - - $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; - $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - - print ''; - print ''; - if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder); - if (! empty($arrayfields['u.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder); - if (! empty($arrayfields['u.firstname']['checked'])) print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder); - if (! empty($arrayfields['u.gender']['checked'])) print_liste_field_titre($langs->trans("Gender"),$_SERVER['PHP_SELF'],"u.gender",$param,"","",$sortfield,$sortorder); - if (! empty($arrayfields['u.employee']['checked'])) print_liste_field_titre($langs->trans("Employee"),$_SERVER['PHP_SELF'],"u.employee",$param,"","",$sortfield,$sortorder); - if (! empty($arrayfields['u.accountancy_code']['checked'])) print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER['PHP_SELF'],"u.accountancy_code",$param,"","",$sortfield,$sortorder); - if (! empty($arrayfields['u.email']['checked'])) print_liste_field_titre($langs->trans("EMail"),$_SERVER['PHP_SELF'],"u.email",$param,"","",$sortfield,$sortorder); - if (! empty($arrayfields['u.fk_soc']['checked'])) print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"u.fk_soc",$param,"","",$sortfield,$sortorder); - if (! empty($arrayfields['u.entity']['checked'])) print_liste_field_titre($langs->trans("Entity"),$_SERVER['PHP_SELF'],"u.entity",$param,"","",$sortfield,$sortorder); - if (! empty($arrayfields['u.fk_user']['checked'])) print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u.fk_user",$param,"","",$sortfield,$sortorder); - if (! empty($arrayfields['u.datelastlogin']['checked'])) print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_titre($langs->trans("PreviousConnexion"),$_SERVER['PHP_SELF'],"u.datepreviouslogin",$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; - if (! empty($arrayfields['u.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"u.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['u.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"u.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['u.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"u.statut","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/user/card.php?id='.$id); + exit; +} - // Search bar - print ''; +llxHeader('',$langs->trans("ListOfUsers")); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($sall != '') $param.='&sall='.urlencode($sall); +if ($search_user != '') $param.="&search_user=".$search_user; +if ($search_login != '') $param.="&search_login=".$search_login; +if ($search_lastname != '') $param.="&search_lastname=".$search_lastname; +if ($search_firstname != '') $param.="&search_firstname=".$search_firstname; +if ($search_gender != '') $param.="&search_gender=".$search_gender; +if ($search_employee != '') $param.="&search_employee=".$search_employee; +if ($search_accountancy_code != '') $param.="&search_accountancy_code=".$search_accountancy_code; +if ($search_email != '') $param.="&search_email=".$search_email; +if ($search_supervisor > 0) $param.="&search_supervisor=".$search_supervisor; +if ($search_statut != '') $param.="&search_statut=".$search_statut; +if ($optioncss != '') $param.='&optioncss='.$optioncss; +if ($mode != '') $param.='&mode='.$mode; +// 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); +} + +$text = $langs->trans("ListOfUsers"); + +print ''."\n"; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); +} + +$moreforfilter=''; + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + +print '
'; +print ''; +if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.firstname']['checked'])) print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.gender']['checked'])) print_liste_field_titre($langs->trans("Gender"),$_SERVER['PHP_SELF'],"u.gender",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.employee']['checked'])) print_liste_field_titre($langs->trans("Employee"),$_SERVER['PHP_SELF'],"u.employee",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.accountancy_code']['checked'])) print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER['PHP_SELF'],"u.accountancy_code",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.email']['checked'])) print_liste_field_titre($langs->trans("EMail"),$_SERVER['PHP_SELF'],"u.email",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.fk_soc']['checked'])) print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"u.fk_soc",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.entity']['checked'])) print_liste_field_titre($langs->trans("Entity"),$_SERVER['PHP_SELF'],"u.entity",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.fk_user']['checked'])) print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u.fk_user",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.datelastlogin']['checked'])) print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_titre($langs->trans("PreviousConnexion"),$_SERVER['PHP_SELF'],"u.datepreviouslogin",$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; +if (! empty($arrayfields['u.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"u.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['u.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"u.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['u.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"u.statut","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + +// Search bar +print ''; +if (! empty($arrayfields['u.login']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['u.lastname']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['u.firstname']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['u.gender']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['u.employee']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['u.accountancy_code']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['u.email']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['u.fk_soc']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['u.entity']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['u.fk_user']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['u.datelastlogin']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['u.datepreviouslogin']['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'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + 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['u.datec']['checked'])) +{ + // Date creation + print ''; +} +if (! empty($arrayfields['u.tms']['checked'])) +{ + // Date modification + print ''; +} +if (! empty($arrayfields['u.statut']['checked'])) +{ + // Status + print ''; +} +// Action column +print ''; + +print "\n"; + +$user2=new User($db); + +$var=True; +$i = 0; +while ($i < min($num,$limit)) +{ + $obj = $db->fetch_object($result); + $var=!$var; + + $userstatic->id=$obj->rowid; + $userstatic->ref=$obj->label; + $userstatic->login=$obj->login; + $userstatic->statut=$obj->statut; + $userstatic->email=$obj->email; + $userstatic->gender=$obj->gender; + $userstatic->societe_id=$obj->fk_soc; + $userstatic->firstname=$obj->firstname; + $userstatic->lastname=$obj->lastname; + $userstatic->employee=$obj->employee; + $userstatic->photo=$obj->photo; + + $li=$userstatic->getNomUrl(-1,'',0,0,24,1,'login'); + + print ""; if (! empty($arrayfields['u.login']['checked'])) - { - print ''; - } + { + print ''; + } if (! empty($arrayfields['u.lastname']['checked'])) - { - print ''; - } + { + print ''; + } if (! empty($arrayfields['u.firstname']['checked'])) - { - print ''; - } + { + print ''; + } if (! empty($arrayfields['u.gender']['checked'])) - { - print ''; - } + { + print ''; + } if (! empty($arrayfields['u.employee']['checked'])) - { - print ''; - } - if (! empty($arrayfields['u.accountancy_code']['checked'])) - { - print ''; - } + { + print ''; + } + if (! empty($arrayfields['u.accountancy_code']['checked'])) + { + print ''; + } if (! empty($arrayfields['u.email']['checked'])) + { + print ''; + } + if (! empty($arrayfields['u.fk_soc']['checked'])) + { + print "'; + } + // Multicompany enabled + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) { - print ''; - } - if (! empty($arrayfields['u.fk_soc']['checked'])) - { - print ''; - } - if (! empty($arrayfields['u.entity']['checked'])) - { - print ''; + if (! empty($arrayfields['u.entity']['checked'])) + { + print ''; + } } + // Supervisor if (! empty($arrayfields['u.fk_user']['checked'])) - { - print ''; - } + { + // Resp + print ''; + } + + // Date last login if (! empty($arrayfields['u.datelastlogin']['checked'])) - { - print ''; - } + { + print ''; + } + // Date previous login if (! empty($arrayfields['u.datepreviouslogin']['checked'])) - { - print ''; - } + { + print ''; + } + // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -390,260 +609,55 @@ if ($result) { if (! empty($arrayfields["ef.".$key]['checked'])) { - $align=$extrafields->getAlignFlag($key); - $typeofextrafield=$extrafields->attribute_type[$key]; - print ''; } } } // Fields from hook - $parameters=array('arrayfields'=>$arrayfields); - $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by 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['u.datec']['checked'])) { - // Date creation - print ''; } + // Date modification if (! empty($arrayfields['u.tms']['checked'])) { - // Date modification - print ''; } + // Status if (! empty($arrayfields['u.statut']['checked'])) { - // Status - print ''; + $userstatic->statut=$obj->statut; + print ''; } // Action column - print ''; - + print ''; + print "\n"; - - $user2=new User($db); - - $var=True; - $i = 0; - while ($i < min($num,$limit)) - { - $obj = $db->fetch_object($result); - $var=!$var; - - $userstatic->id=$obj->rowid; - $userstatic->ref=$obj->label; - $userstatic->login=$obj->login; - $userstatic->statut=$obj->statut; - $userstatic->email=$obj->email; - $userstatic->gender=$obj->gender; - $userstatic->societe_id=$obj->fk_soc; - $userstatic->firstname=$obj->firstname; - $userstatic->lastname=$obj->lastname; - $userstatic->employee=$obj->employee; - $userstatic->photo=$obj->photo; - - $li=$userstatic->getNomUrl(-1,'',0,0,24,1,'login'); - - print ""; - if (! empty($arrayfields['u.login']['checked'])) - { - print ''; - } - if (! empty($arrayfields['u.lastname']['checked'])) - { - print ''; - } - if (! empty($arrayfields['u.firstname']['checked'])) - { - print ''; - } - if (! empty($arrayfields['u.gender']['checked'])) - { - print ''; - } - if (! empty($arrayfields['u.employee']['checked'])) - { - print ''; - } - if (! empty($arrayfields['u.accountancy_code']['checked'])) - { - print ''; - } - if (! empty($arrayfields['u.email']['checked'])) - { - print ''; - } - if (! empty($arrayfields['u.fk_soc']['checked'])) - { - print "'; - } - // Multicompany enabled - if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) - { - if (! empty($arrayfields['u.entity']['checked'])) - { - print ''; - } - } - // Supervisor - if (! empty($arrayfields['u.fk_user']['checked'])) - { - // Resp - print ''; - } - - // Date last login - if (! empty($arrayfields['u.datelastlogin']['checked'])) - { - print ''; - } - // Date previous login - if (! empty($arrayfields['u.datepreviouslogin']['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['u.datec']['checked'])) - { - print ''; - } - // Date modification - if (! empty($arrayfields['u.tms']['checked'])) - { - print ''; - } - // Status - if (! empty($arrayfields['u.statut']['checked'])) - { - $userstatic->statut=$obj->statut; - print ''; - } - // Action column - print ''; - - print "\n"; - $i++; - } - - $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); - $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print "
'; + $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); + print $form->selectarray('search_gender', $arraygender, $search_gender, 1); + print ''; + print $form->selectyesno('search_employee', $search_employee, 1, false, 1); + print ''; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + print ''; + print ''; + print ''; + print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); + print ''; +$searchpitco=$form->showFilterAndCheckAddButtons(0); +print $searchpitco; +print '
'; + print $li; + if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity) + { + print img_picto($langs->trans("SuperAdministrator"),'redstar'); + } + else if ($obj->admin) + { + print img_picto($langs->trans("Administrator"),'star'); + } + print ''.$obj->lastname.''.$obj->firstname.''; - $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); - print $form->selectarray('search_gender', $arraygender, $search_gender, 1); - print ''; + if ($obj->gender) print $langs->trans("Gender".$obj->gender); + print ''; - print $form->selectyesno('search_employee', $search_employee, 1, false, 1); - print ''.yn($obj->employee).''.$obj->accountancy_code.''.$obj->email.'"; + if ($obj->fk_soc) + { + $companystatic->id=$obj->fk_soc; + $companystatic->name=$obj->name; + $companystatic->canvas=$obj->canvas; + print $companystatic->getNomUrl(1); + } + else if ($obj->ldap_sid) + { + print $langs->trans("DomainUser"); + } + else + { + print $langs->trans("InternalUser"); + } + print ''; + if (! $obj->entity) + { + print $langs->trans("AllEntities"); + } + else + { + // $mc is defined in conf.class.php if multicompany enabled. + if (is_object($mc)) + { + $mc->getInfo($obj->entity); + print $mc->label; + } + } + print ''; + if ($obj->login2) + { + $user2->id=$obj->id2; + $user2->login=$obj->login2; + $user2->lastname=$obj->lastname2; + $user2->firstname=$obj->firstname2; + $user2->gender=$obj->gender2; + $user2->photo=$obj->photo2; + $user2->admin=$obj->admin2; + $user2->email=$obj->email2; + $user2->societe_id=$obj->fk_soc2; + print $user2->getNomUrl(-1,'',0,0,24,0,''); + if (! empty($conf->multicompany->enabled) && $obj->admin2 && ! $obj->entity2) + { + print img_picto($langs->trans("SuperAdministrator"),'redstar'); + } + else if ($obj->admin2) + { + print img_picto($langs->trans("Administrator"),'star'); + } + } + print ''.dol_print_date($db->jdate($obj->datelastlogin),"dayhour").''.dol_print_date($db->jdate($obj->datepreviouslogin),"dayhour").''; - if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) - { - $crit=$val; - $tmpkey=preg_replace('/search_options_/','',$key); - $searchclass=''; - if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; - if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; - print ''; - } + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print ''; + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); print ''; + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''; - print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); - print ''.$userstatic->getLibStatut(3).''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - print '
'; - print $li; - if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity) - { - print img_picto($langs->trans("SuperAdministrator"),'redstar'); - } - else if ($obj->admin) - { - print img_picto($langs->trans("Administrator"),'star'); - } - print ''.$obj->lastname.''.$obj->firstname.''; - if ($obj->gender) print $langs->trans("Gender".$obj->gender); - print ''.yn($obj->employee).''.$obj->accountancy_code.''.$obj->email.'"; - if ($obj->fk_soc) - { - $companystatic->id=$obj->fk_soc; - $companystatic->name=$obj->name; - $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1); - } - else if ($obj->ldap_sid) - { - print $langs->trans("DomainUser"); - } - else - { - print $langs->trans("InternalUser"); - } - print ''; - if (! $obj->entity) - { - print $langs->trans("AllEntities"); - } - else - { - // $mc is defined in conf.class.php if multicompany enabled. - if (is_object($mc)) - { - $mc->getInfo($obj->entity); - print $mc->label; - } - } - print ''; - if ($obj->login2) - { - $user2->id=$obj->id2; - $user2->login=$obj->login2; - $user2->lastname=$obj->lastname2; - $user2->firstname=$obj->firstname2; - $user2->gender=$obj->gender2; - $user2->photo=$obj->photo2; - $user2->admin=$obj->admin2; - $user2->email=$obj->email2; - $user2->societe_id=$obj->fk_soc2; - print $user2->getNomUrl(-1,'',0,0,24,0,''); - if (! empty($conf->multicompany->enabled) && $obj->admin2 && ! $obj->entity2) - { - print img_picto($langs->trans("SuperAdministrator"),'redstar'); - } - else if ($obj->admin2) - { - print img_picto($langs->trans("Administrator"),'star'); - } - } - print ''.dol_print_date($db->jdate($obj->datelastlogin),"dayhour").''.dol_print_date($db->jdate($obj->datepreviouslogin),"dayhour").''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour'); - print ''.$userstatic->getLibStatut(3).'
"; - print "
\n"; - $db->free($result); -} -else -{ - dol_print_error($db); + $i++; } +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print ""; +print "\n"; +$db->free($result); + + llxFooter(); - $db->close(); From 6661773a061f12720df7d2b94357c07ee723e2c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Nov 2016 16:37:24 +0100 Subject: [PATCH 09/56] Clean menu --- htdocs/core/menus/init_menu_auguria.sql | 6 ++---- htdocs/core/menus/standard/eldy.lib.php | 10 +++++----- htdocs/langs/en_US/accountancy.lang | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 07b737c8bbf..bb53a0dd1da 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -317,15 +317,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4206__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?leftmenu=members&statut=1&filter=uptodate', 'MenuMembersUpToDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4207__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?leftmenu=members&statut=0', 'MenuMembersResiliated', 2, 'members', '$user->rights->adherent->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4208__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/stats/geo.php?leftmenu=members&mode=memberbycountry', 'MenuMembersStats', 1, 'members', '$user->rights->adherent->lire', '', 2, 7, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && $conf->adherent->enabled', __HANDLER__, 'left', 4502__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/htpasswd.php?leftmenu=export', 'Filehtpasswd', 1, 'members', '$user->rights->adherent->export', '', 2, 9, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4503__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/cartes/carte.php?leftmenu=export', 'MembersCards', 1, 'members', '$user->rights->adherent->export', '', 2, 10, __ENTITY__); -- Members - Subscriptions insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4300__+MAX_llx_menu__, 'members', '', 13__+MAX_llx_menu__, '/adherents/index.php?leftmenu=members&mainmenu=members', 'Subscriptions', 0, 'compta', '$user->rights->adherent->cotisation->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4301__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/list.php?statut=-1&leftmenu=accountancy&mainmenu=members', 'NewSubscription', 1, 'compta', '$user->rights->adherent->cotisation->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4302__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/subscription/list.php?leftmenu=members', 'List', 1, 'compta', '$user->rights->adherent->cotisation->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4303__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/stats/index.php?leftmenu=members', 'MenuMembersStats', 1, 'members', '$user->rights->adherent->lire', '', 2, 7, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4500__+MAX_llx_menu__, 'members', 'export', 13__+MAX_llx_menu__, '/adherents/index.php?leftmenu=export&mainmenu=members', 'Exports', 0, 'members', '$user->rights->adherent->export', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->export->enabled', __HANDLER__, 'left', 4501__+MAX_llx_menu__, 'members', '', 4500__+MAX_llx_menu__, '/exports/index.php?leftmenu=export', 'Datas', 1, 'members', '$user->rights->adherent->export', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4502__+MAX_llx_menu__, 'members', '', 4500__+MAX_llx_menu__, '/adherents/htpasswd.php?leftmenu=export', 'Filehtpasswd', 1, 'members', '$user->rights->adherent->export', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4503__+MAX_llx_menu__, 'members', '', 4500__+MAX_llx_menu__, '/adherents/cartes/carte.php?leftmenu=export', 'MembersCards', 1, 'members', '$user->rights->adherent->export', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4700__+MAX_llx_menu__, 'members', 'setup', 13__+MAX_llx_menu__, '/adherents/type.php?leftmenu=setup&mainmenu=members', 'MembersTypes', 0, 'members', '$user->rights->adherent->configurer', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4701__+MAX_llx_menu__, 'members', '', 4700__+MAX_llx_menu__, '/adherents/type.php?leftmenu=setup&mainmenu=members&action=create', 'New', 1, 'members', '$user->rights->adherent->configurer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4702__+MAX_llx_menu__, 'members', '', 4700__+MAX_llx_menu__, '/adherents/type.php?leftmenu=setup&mainmenu=members', 'List', 1, 'members', '$user->rights->adherent->configurer', '', 2, 1, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index e64d6318105..69c9e441c98 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1364,7 +1364,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate",$langs->trans("MenuMembersNotUpToDate"),2,$user->rights->adherent->lire); $newmenu->add("/adherents/list.php?leftmenu=members&statut=0",$langs->trans("MenuMembersResiliated"),2,$user->rights->adherent->lire); $newmenu->add("/adherents/stats/index.php?leftmenu=members",$langs->trans("MenuMembersStats"),1,$user->rights->adherent->lire); - + if (! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && (empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export); + if (empty($leftmenu) || $leftmenu=="export") $newmenu->add("/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export); + $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire); $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1,1&mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer); $newmenu->add("/adherents/subscription/list.php?leftmenu=members",$langs->trans("List"),1,$user->rights->adherent->cotisation->lire); @@ -1379,10 +1381,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } - $newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Exports"),0,$user->rights->adherent->export, '', $mainmenu, 'export'); - if (! empty($conf->export->enabled) && (empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); - if (empty($leftmenu) || $leftmenu=="export") $newmenu->add("/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export); - if (empty($leftmenu) || $leftmenu=="export") $newmenu->add("/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export); + //$newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Tools"),0,$user->rights->adherent->export, '', $mainmenu, 'export'); + //if (! empty($conf->export->enabled) && (empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); // Type $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members",$langs->trans("MembersTypes"),0,$user->rights->adherent->configurer, '', $mainmenu, 'setup'); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 99131bd5c0c..d24ec11a502 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -20,7 +20,7 @@ Chartofaccounts=Chart of accounts AccountancyArea=Accountancy area AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: AccountancyAreaDescActionOnce=The following actions are usually executed one time only, or once per year... -AccountancyAreaDescActionOnceBis=Next step should be done to save you time in future by suggesting you the correct default accounting account when making thee journalization (writing record in Journals and General ledger) +AccountancyAreaDescActionOnceBis=Next steps should be done to save you time in future by suggesting you the correct default accounting account when making thee journalization (writing record in Journals and General ledger) AccountancyAreaDescActionFreq=The following actions are usually executed every month, week or day for very large companies... AccountancyAreaDescChartModel=STEP %s: Create a model of chart of account from menu %s AccountancyAreaDescChart=STEP %s: Create or check content of your chart of account from menu %s From 59291be6e0c60df2a712af5eca45470a56d489b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Nov 2016 19:39:54 +0100 Subject: [PATCH 10/56] NEW Can filter on status on objects on the "statistics" page. --- htdocs/adherents/class/adherent.class.php | 11 ++ htdocs/adherents/list.php | 2 +- htdocs/comm/propal/stats/index.php | 7 +- htdocs/commande/list.php | 10 +- htdocs/commande/stats/index.php | 32 ++++++ htdocs/compta/bank/bankentries.php | 5 +- htdocs/compta/facture/stats/index.php | 24 +++- htdocs/core/class/html.formpropal.class.php | 22 ++-- .../html.formsupplier_proposal.class.php | 104 ------------------ htdocs/langs/en_US/supplier_proposal.lang | 1 + htdocs/supplier_proposal/card.php | 2 - .../class/supplier_proposal.class.php | 7 +- htdocs/supplier_proposal/list.php | 6 +- 13 files changed, 101 insertions(+), 132 deletions(-) delete mode 100644 htdocs/core/class/html.formsupplier_proposal.class.php diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 191b23bea32..79c12e68561 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1682,6 +1682,17 @@ class Adherent extends CommonObject if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliated"); } if ($mode == 5) + { + if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); + if ($statut >= 1) + { + if (! $date_end_subscription) return ''.$langs->trans("MemberStatusActiveShort").' '.img_picto($langs->trans('MemberStatusActive'),'statut1'); + elseif ($date_end_subscription < time()) return ''.$langs->trans("MemberStatusActiveLateShort").' '.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); + else return ''.$langs->trans("MemberStatusPaidShort").' '.img_picto($langs->trans('MemberStatusPaid'),'statut4'); + } + if ($statut == 0) return ''.$langs->trans("MemberStatusResiliated").' '.img_picto($langs->trans('MemberStatusResiliated'),'statut5'); + } + if ($mode == 6) { if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); if ($statut >= 1) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index c98ad4abf31..0727002aa59 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -809,7 +809,7 @@ while ($i < $num && $i < $conf->liste_limit) if (! empty($arrayfields['d.statut']['checked'])) { print ''; - print $memberstatic->LibStatut($obj->statut,$obj->subscription,$datefin,2); + print $memberstatic->LibStatut($obj->statut,$obj->subscription,$datefin,5); print ''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index aa5a865dbf2..04c1af11e1d 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -37,7 +37,7 @@ $mode=GETPOST("mode")?GETPOST("mode"):'customer'; if ($mode == 'customer' && ! $user->rights->propale->lire) accessforbidden(); if ($mode == 'supplier' && ! $user->rights->supplier_proposal->lire) accessforbidden(); -$object_statut=GETPOST('propal_statut'); +$object_status=GETPOST('object_status'); $userid=GETPOST('userid','int'); $socid=GETPOST('socid','int'); @@ -58,6 +58,7 @@ $langs->load('orders'); $langs->load('companies'); $langs->load('other'); $langs->load('suppliers'); +$langs->load('supplier_proposal'); /* @@ -91,7 +92,7 @@ dol_mkdir($dir); $stats = new PropaleStats($db, $socid, ($userid>0?$userid:0), $mode); -if ($object_statut != '' && $object_statut >= 0) $stats->where .= ' AND p.fk_statut IN ('.$object_statut.')'; +if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND p.fk_statut IN ('.$object_status.')'; // Build graphic number of object $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); @@ -265,7 +266,7 @@ print '
'; print ''; // Status print ''.$langs->trans("Status").''; - $formpropal->selectProposalStatus($object_statut,0,1,1,$mode); + $formpropal->selectProposalStatus(($object_status!=''?$object_status:-1),0,0,1,$mode,'object_status'); print ''; // Year print ''.$langs->trans("Year").''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 14c2b88214e..87a95062323 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1014,11 +1014,11 @@ if ($resql) { print ''; $liststatus=array( - '0'=>$langs->trans("StatusOrderDraftShort"), - '1'=>$langs->trans("StatusOrderValidated"), - '2'=>$langs->trans("StatusOrderSentShort"), - '3'=>$langs->trans("StatusOrderDelivered"), - '-1'=>$langs->trans("StatusOrderCanceledShort") + Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"), + Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), + Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"), + Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), + Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort") ); print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4); print ''; diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 1f0f763bfd1..55b82d1063c 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -28,6 +28,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $WIDTH=DolGraph::getDefaultGraphSizeForStats('width'); @@ -37,6 +38,8 @@ $mode=GETPOST("mode")?GETPOST("mode"):'customer'; if ($mode == 'customer' && ! $user->rights->commande->lire) accessforbidden(); if ($mode == 'supplier' && ! $user->rights->fournisseur->commande->lire) accessforbidden(); +$object_status=GETPOST('object_status'); + $userid=GETPOST('userid','int'); $socid=GETPOST('socid','int'); // Security check @@ -63,6 +66,7 @@ $langs->load('suppliers'); */ $form=new Form($db); +$formorder=new FormOrder($db); if ($mode == 'customer') { @@ -82,9 +86,19 @@ print load_fiche_titre($title,'','title_commercial.png'); dol_mkdir($dir); $stats = new CommandeStats($db, $socid, $mode, ($userid>0?$userid:0)); +if ($mode == 'customer') +{ + if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')'; +} +if ($mode == 'supplier') +{ + if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')'; +} + // Build graphic number of object $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); + //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) @@ -261,6 +275,24 @@ print '
'; // User print ''.$langs->trans("CreatedBy").''; print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + // Status + print ''.$langs->trans("Status").''; + if ($mode == 'customer') + { + $liststatus=array( + Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraft"), + Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), + Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSent"), + Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), + Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled") + ); + print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4); + } + if ($mode == 'supplier') + { + $formorder->selectSupplierOrderStatus((strstr($object_status, ',')?-1:$object_status), 0, 'object_status'); + } + print ''; // Year print ''.$langs->trans("Year").''; if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index bb56c494854..477c65a66b3 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -108,14 +108,13 @@ if (! $sortfield) $sortfield='b.datev'; $mode_balance_ok=false; //if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid')) // TODO Manage balance when account not selected -if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid') && ($id > 0 || ! empty($ref))) +if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid')) { $sortfield = 'b.datev, b.dateo, b.rowid'; - $mode_balance_ok = true; + if ($id > 0 || ! empty($ref) || $account > 0) $mode_balance_ok = true; } if (strtolower($sortorder) == 'desc') $mode_balance_ok = false; - $object = new Account($db); if ($id > 0 || ! empty($ref)) { diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 9ca0c2f7718..5c5aa8489be 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -36,6 +36,8 @@ $mode=GETPOST("mode")?GETPOST("mode"):'customer'; if ($mode == 'customer' && ! $user->rights->facture->lire) accessforbidden(); if ($mode == 'supplier' && ! $user->rights->fournisseur->facture->lire) accessforbidden(); +$object_status=GETPOST('object_status'); + $userid=GETPOST('userid','int'); $socid=GETPOST('socid','int'); // Security check @@ -80,7 +82,14 @@ print load_fiche_titre($title, $mesg, 'title_accountancy.png'); dol_mkdir($dir); $stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0)); - +if ($mode == 'customer') +{ + if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')'; +} +if ($mode == 'supplier') +{ + if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')'; +} // Build graphic number of object // $data = array(array('Lib',val1,val2,val3),...) @@ -246,6 +255,19 @@ print '
'; print ''.$langs->trans("CreatedBy").''; print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print ''; + // Status + print ''.$langs->trans("Status").''; + if ($mode == 'customer') + { + $liststatus=array('0'=>$langs->trans("BillStatusDraft"), '1'=>$langs->trans("BillStatusNotPaid"), '2'=>$langs->trans("BillStatusPaid"), '3'=>$langs->trans("BillStatusCanceled")); + print $form->selectarray('object_status', $liststatus, $object_status, 1); + } + if ($mode == 'supplier') + { + $liststatus=array('0'=>$langs->trans("BillStatusDraft"),'1'=>$langs->trans("BillStatusNotPaid"), '2'=>$langs->trans("BillStatusPaid")); + print $form->selectarray('object_status', $liststatus, $object_status, 1); + } + print ''; // Year print ''.$langs->trans("Year").''; if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index 57dd6336a43..2cfeaadd368 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -50,9 +50,10 @@ class FormPropal * @param int $excludedraft 0=All status, 1=Exclude draft status * @param int $showempty 1=Add empty line * @param string $mode 'customer', 'supplier' + * @param string $htmlname Name of select field * @return void */ - function selectProposalStatus($selected='',$short=0, $excludedraft=0, $showempty=1, $mode='customer') + function selectProposalStatus($selected='',$short=0, $excludedraft=0, $showempty=1, $mode='customer',$htmlname='propal_statut') { global $langs; @@ -63,7 +64,13 @@ class FormPropal $prefix='SupplierProposalStatus'; $langs->load("supplier_proposal"); - $listofstatus=array(0=>array('code'=>'PR_DRAFT'), 1=>array('code'=>'PR_OPEN'), 2=>array('code'=>'PR_SIGNED'), 3=>array('code'=>'PR_NOTSIGNED'), 4=>array('code'=>'PR_CLOSED')); + $listofstatus=array( + 0=>array('id'=>0, 'code'=>'PR_DRAFT'), + 1=>array('id'=>1, 'code'=>'PR_OPEN'), + 2=>array('id'=>2, 'code'=>'PR_SIGNED'), + 3=>array('id'=>3, 'code'=>'PR_NOTSIGNED'), + 4=>array('id'=>4, 'code'=>'PR_CLOSED') + ); } else { @@ -93,7 +100,7 @@ class FormPropal } } - print ''; if ($showempty) print ''; foreach($listofstatus as $key => $obj) @@ -115,15 +122,16 @@ class FormPropal print ''; $i++; diff --git a/htdocs/core/class/html.formsupplier_proposal.class.php b/htdocs/core/class/html.formsupplier_proposal.class.php deleted file mode 100644 index ed8781731a0..00000000000 --- a/htdocs/core/class/html.formsupplier_proposal.class.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/core/class/html.formpropal.class.php - * \ingroup core - * \brief File of class with all html predefined components - */ - - -/** - * Class to manage generation of HTML components for proposal management - */ -class FormSupplierProposal -{ - var $db; - var $error; - - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - } - - /** - * Return combo list of differents status of a proposal - * Values are id of table c_propalst - * - * @param string $selected Preselected value - * @param int $short Use short labels - * @return void - */ - function selectSupplierProposalStatus($selected='',$short=0) - { - global $langs; - - $sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst"; - $sql .= " WHERE active = 1"; - - dol_syslog(get_class($this)."::selectSupplierProposalStatus", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - print ''; - } - else - { - dol_print_error($this->db); - } - } - -} - diff --git a/htdocs/langs/en_US/supplier_proposal.lang b/htdocs/langs/en_US/supplier_proposal.lang index 94c0ef2e039..621d7784e35 100644 --- a/htdocs/langs/en_US/supplier_proposal.lang +++ b/htdocs/langs/en_US/supplier_proposal.lang @@ -28,6 +28,7 @@ SupplierProposalStatusClosed=Closed SupplierProposalStatusSigned=Accepted SupplierProposalStatusNotSigned=Refused SupplierProposalStatusDraftShort=Draft +SupplierProposalStatusValidatedShort=Validated SupplierProposalStatusClosedShort=Closed SupplierProposalStatusSignedShort=Accepted SupplierProposalStatusNotSignedShort=Refused diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 0658416797e..804c02cfa68 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -34,7 +34,6 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formsupplier_proposal.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmargin.class.php'; require_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php'; require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; @@ -997,7 +996,6 @@ llxHeader('', $langs->trans('CommRequests'), 'EN:Ask_Price_Supplier|FR:Demande_d $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); -$formsupplier_proposal = new FormSupplierProposal($db); $formmargin = new FormMargin($db); $companystatic = new Societe($db); if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 45dacd3805a..1d249ad627d 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2095,11 +2095,12 @@ class SupplierProposal extends CommonObject if ($mode == 0) return $this->labelstatut[$statut]; if ($mode == 1) return $this->labelstatut_short[$statut]; - if ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; + if ($mode == 2) return img_picto($this->labelstatut[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; - if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut_short[$statut],$statuttrans); - } + if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + if ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + } /** diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index e51ddfcdceb..a50e8509ba5 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -34,8 +34,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsupplier_proposal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -191,7 +191,7 @@ llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_p $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); -$formsupplier_proposal = new FormSupplierProposal($db); +$formpropal = new FormPropal($db); $companystatic=new Societe($db); $now=dol_now(); @@ -388,7 +388,7 @@ if ($result) print ''; print ''; print ''; - $formsupplier_proposal->selectSupplierProposalStatus($viewstatut,1); + $formpropal->selectProposalStatus($viewstatut,1,0,1,'supplier'); print ''; // Check boxes print ''; From 5b2a44f16f543cda00f879ea8ab53dc69d1f470d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Nov 2016 20:10:01 +0100 Subject: [PATCH 11/56] Fix phpunit regression --- htdocs/fourn/class/fournisseur.facture.class.php | 3 +-- htdocs/fourn/facture/card.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 534f12b3877..d8490fde20b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -694,7 +694,6 @@ class FactureFournisseur extends CommonInvoice if (isset($this->tva)) $this->tva=trim($this->tva); if (isset($this->localtax1)) $this->localtax1=trim($this->localtax1); if (isset($this->localtax2)) $this->localtax2=trim($this->localtax2); - if (empty($this->total)) $this->total=0; if (empty($this->total_ht)) $this->total_ht=0; if (empty($this->total_tva)) $this->total_tva=0; // if (isset($this->total_localtax1)) $this->total_localtax1=trim($this->total_localtax1); @@ -734,7 +733,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " tva=".(isset($this->tva)?$this->tva:"null").","; $sql.= " localtax1=".(isset($this->localtax1)?$this->localtax1:"null").","; $sql.= " localtax2=".(isset($this->localtax2)?$this->localtax2:"null").","; - $sql.= " total=".(isset($this->total)?$this->total:"null").","; + //$sql.= " total=".(isset($this->total)?$this->total:"null").","; $sql.= " total_ht=".(isset($this->total_ht)?$this->total_ht:"null").","; $sql.= " total_tva=".(isset($this->total_tva)?$this->total_tva:"null").","; $sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").","; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index e301c7aaa13..113c698f7f4 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -309,7 +309,7 @@ if (empty($reshook)) elseif ($action == 'setlabel' && $user->rights->fournisseur->facture->creer) { $object->fetch($id); - $object->label=$_POST['label']; + $object->label=GETPOST('label'); $result=$object->update($user); if ($result < 0) dol_print_error($db); } From 6ceb79cf5abfbae550dc7cb28272c8525c505a45 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Nov 2016 20:55:55 +0100 Subject: [PATCH 12/56] Uniformise look and feel --- htdocs/compta/index.php | 4 +- htdocs/compta/sociales/index.php | 18 ++++--- htdocs/fourn/facture/card.php | 36 +++++++------- htdocs/langs/en_US/orders.lang | 1 + htdocs/supplier_proposal/card.php | 80 ++++++++----------------------- 5 files changed, 53 insertions(+), 86 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 1dd1c46299a..40e3b80a510 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -577,7 +577,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -663,7 +663,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $i = 0; print '
'.$langs->trans("ContributionsToPay").($num?' '.$num.'':'').''.$langs->trans("ContributionsToPay").($num?' '.$num.'':'').''.$langs->trans("DateDue").''.$langs->trans("AmountTTC").''.$langs->trans("Paid").'
'; print ""; - print ''; + print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index fc106de2ad1..80364960406 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -40,6 +40,7 @@ $result = restrictedArea($user, 'tax', '', '', 'charges'); $search_ref = GETPOST('search_ref','int'); $search_label = GETPOST('search_label','alpha'); $search_amount = GETPOST('search_amount','alpha'); +$search_status = GETPOST('search_status','int'); $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); @@ -52,8 +53,8 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield="cs.date_ech"; if (! $sortorder) $sortorder="DESC"; -$year=$_GET["year"]; -$filtre=$_GET["filtre"]; +$year=GETPOST("year",'int'); +$filtre=GETPOST("filtre",'int'); if (empty($_REQUEST['typeid'])) { @@ -88,7 +89,7 @@ $form = new Form($db); $formsocialcontrib = new FormSocialContrib($db); $chargesociale_static=new ChargeSociales($db); -llxHeader(); +llxHeader('', $langs->trans("SocialContributions")); $sql = "SELECT cs.rowid as id, cs.fk_type as type, "; $sql.= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,"; @@ -99,11 +100,11 @@ $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; $sql.= " WHERE cs.fk_type = c.id"; $sql.= " AND cs.entity = ".$conf->entity; - // Search criteria -if ($search_ref) $sql.=" AND cs.rowid=".$search_ref; +if ($search_ref) $sql.=" AND cs.rowid=".$db->escape($search_ref); if ($search_label) $sql.=natural_search("cs.libelle", $search_label); if ($search_amount) $sql.=natural_search("cs.amount", price2num(trim($search_amount)), 1); +if ($search_status != '') $sql.=" AND cs.paye = ".$db->escape($search_status); if ($year > 0) { $sql .= " AND ("; @@ -118,7 +119,7 @@ if ($filtre) { $sql .= " AND ".$filtre; } if ($typeid) { - $sql .= " AND cs.fk_type=".$typeid; + $sql .= " AND cs.fk_type=".$db->escape($typeid); } $sql.= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle"; $sql.= $db->order($sortfield,$sortorder); @@ -204,7 +205,10 @@ if ($resql) print ''; print ''; // Status - print ''; + print ''; print ''; - // Project - /* - if (! empty($conf->projet->enabled)) { - $langs->load("projects"); - print ''; - } else { - print '
'.$langs->trans("OrdersToBill").' '.$num.''.$langs->trans("OrdersDeliveredToBill").' '.$num.''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("ToBill").'  '; + $liststatus=array('0'=>$langs->trans("Unpaid"), '1'=>$langs->trans("Paid")); + print $form->selectarray('search_status', $liststatus, $search_status, 1); + print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 113c698f7f4..103850509a5 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2252,6 +2252,24 @@ else print ''; + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } + // Amount print ''; print ''; - if (!empty($conf->multicurrency->enabled)) - { - // Multicurrency Amount HT - print ''; - print ''; - print ''; - - // Multicurrency Amount VAT - print ''; - print ''; - print ''; - - // Multicurrency Amount TTC - print ''; - print ''; - print ''; - } - print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'
'.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'
        '; @@ -2282,24 +2300,6 @@ else } print '
'.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'; /* diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 45997ef6cb5..2f0579394eb 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -19,6 +19,7 @@ CustomerOrder=Customer order CustomersOrders=Customer orders CustomersOrdersRunning=Current customer orders CustomersOrdersAndOrdersLines=Customer orders and order lines +OrdersDeliveredToBill=Customer orders delivered to bill OrdersToBill=Customer orders delivered OrdersInProcess=Customer orders in process OrdersToProcess=Customer orders to process diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 804c02cfa68..3ab1c159545 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1476,41 +1476,6 @@ if ($action == 'create') } print '
'; - print ''; - if ($user->rights->supplier_proposal->creer) { - if ($action != 'classify') - print ''; - print '
'; - print $langs->trans('Project') . '' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '
'; - print '
'; - if ($action == 'classify') { - $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid'); - } else { - $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none'); - } - print '
'; - if (! empty($object->fk_project)) { - print ''; - $proj = new Project($db); - $proj->fetch($object->fk_project); - print ''; - print $proj->ref; - print ''; - print ''; - } else { - print ' '; - } - } - print ''; - }*/ - // Multicurrency if (! empty($conf->multicurrency->enabled)) { @@ -1594,14 +1559,32 @@ if ($action == 'create') print ''; + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } + // Amount HT - print ''; - print ''; + print ''; + print ''; print ''; // Amount VAT print ''; - print ''; + print ''; print ''; // Amount Local Taxes @@ -1623,27 +1606,6 @@ if ($action == 'create') print ''; print ''; - if (!empty($conf->multicurrency->enabled)) - { - // Multicurrency Amount HT - print ''; - print ''; - print ''; - - // Multicurrency Amount VAT - print ''; - print ''; - print ''; - - // Multicurrency Amount TTC - print ''; - print ''; - print ''; - } - - // Statut - //print ''; - print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '
'; // Margin Infos From 0f016bbbcb7237665b4a17b5081137c39bbc07a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Nov 2016 20:57:19 +0100 Subject: [PATCH 13/56] Uniformise look and feel --- htdocs/compta/sociales/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 80364960406..6a4f7f836e7 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -76,6 +76,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_ref=""; $search_label=""; $search_amount=""; + $search_status=''; $typeid=""; $year=""; $month=""; @@ -104,7 +105,7 @@ $sql.= " AND cs.entity = ".$conf->entity; if ($search_ref) $sql.=" AND cs.rowid=".$db->escape($search_ref); if ($search_label) $sql.=natural_search("cs.libelle", $search_label); if ($search_amount) $sql.=natural_search("cs.amount", price2num(trim($search_amount)), 1); -if ($search_status != '') $sql.=" AND cs.paye = ".$db->escape($search_status); +if ($search_status != '' && $search_status >= 0) $sql.=" AND cs.paye = ".$db->escape($search_status); if ($year > 0) { $sql .= " AND ("; From e59c2bb61ca654b371191bd04d12c54df86f7791 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Nov 2016 15:43:30 +0100 Subject: [PATCH 14/56] Debug accounting menu. Can now edit product account if already set. --- htdocs/accountancy/admin/account.php | 6 +- htdocs/accountancy/admin/defaultaccounts.php | 2 +- htdocs/accountancy/admin/productaccount.php | 221 ++++++++++++------ .../class/html.formventilation.class.php | 15 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/langs/en_US/accountancy.lang | 10 +- htdocs/langs/en_US/products.lang | 1 + htdocs/product/class/product.class.php | 22 +- 8 files changed, 184 insertions(+), 95 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 95ba62de0c5..cb3255f981d 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -256,10 +256,8 @@ if ($resql) { print ''; print ' '; print ''; - - print ''; - print ' '; - print ''; + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + print $searchpitco; print ''; print ''; diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index a66217ebbee..6854c8a45ff 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -138,7 +138,7 @@ foreach ( $list_account as $key ) { $label = $langs->trans($key); print '' . $label . ''; // Value - print ''; + print ''; // Do not force align=right, or it align also the content of the select box print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1); print ''; print ''; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 495fb2a1304..5de8be91d20 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -40,6 +40,7 @@ $langs->load("companies"); $langs->load("compta"); $langs->load("main"); $langs->load("accountancy"); +$langs->load("products"); // Security check if (empty($conf->accounting->enabled)) { @@ -61,6 +62,10 @@ $changeaccount_sell = GETPOST('changeaccount_sell', 'array'); $search_ref = GETPOST('search_ref', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); $search_desc = GETPOST('search_desc', 'alpha'); +$search_current_account = GETPOST('search_current_account', 'alpha'); +$search_current_account_valid = GETPOST('search_current_account_valid', 'alpha'); +if ($search_current_account_valid == '') $search_current_account_valid='withoutvalidaccount'; + $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha'); $btn_changeaccount = GETPOST('changeaccount'); $btn_changetype = GETPOST('changetype'); @@ -85,12 +90,21 @@ $arrayfields=array(); * Actions */ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { $search_ref = ''; $search_label = ''; $search_desc = ''; + $search_current_account = ''; + $search_current_account_valid = '-1'; } // Sales or Purchase mode ? @@ -189,23 +203,38 @@ $aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? llxHeader('', $langs->trans("ProductsBinding")); -$pcgver = $conf->global->CHARTOFACCOUNTS; +$pcgverid = $conf->global->CHARTOFACCOUNTS; +$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version'); +if (empty($pcgvercode)) $pcgvercode=$pcgverid; -$sql = "SELECT p.rowid, p.ref, p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type"; -$sql .= " FROM " . MAIN_DB_PREFIX . "product as p"; -$sql .= " WHERE ("; -if ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') { - $sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL"; - $sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN - (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))"; -} else { - $sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL "; - $sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN - (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))"; +$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy, p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type,"; +$sql.= " aa.rowid as aaid"; +$sql.= " FROM " . MAIN_DB_PREFIX . "product as p"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON"; +if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { + $sql.=" p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'"; } -$sql .= ")"; -if (! empty($conf->multicompany->enabled)) { - $sql.= ' AND p.entity IN ('.getEntity('product', 1).')'; +else +{ + $sql.=" p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'"; +} +$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; +if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { + if (strlen(trim($search_current_account))) { + $sql .= natural_search("p.accountancy_code_buy",$search_current_account); + } +} else { + if (strlen(trim($search_current_account))) { + $sql .= natural_search("p.accountancy_code_sell",$search_current_account); + } +} +if ($search_current_account_valid == 'withoutvalidaccount') +{ + $sql .= " AND aa.account_number IS NULL"; +} +if ($search_current_account_valid == 'withvalidaccount') +{ + $sql .= " AND aa.account_number IS NOT NULL"; } // Add search filter like if (strlen(trim($search_ref))) { @@ -218,6 +247,7 @@ if (strlen(trim($search_desc))) { $sql .= natural_search("p.description",$search_desc); } $sql .= $db->order($sortfield, $sortorder); + $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -236,9 +266,11 @@ if ($result) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($search_ref > 0) $param.="&search_desc=".urlencode($search_ref); - if ($search_label > 0) $param.="&search_desc=".urlencode($search_label); - if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc); + if ($search_ref > 0) $param.="&search_desc=".urlencode($search_ref); + if ($search_label > 0) $param.="&search_desc=".urlencode($search_label); + if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc); + if ($search_current_account > 0) $param.="&search_current_account=".urlencode($search_current_account); + if ($search_current_account_valid && $search_current_account_valid != '-1') $param.="&search_current_account_valid=".urlencode($search_current_account_valid); print '
'; if ($optioncss != '') print ''; @@ -260,11 +292,10 @@ if ($result) print '' . $langs->trans('Options') . '' . $langs->trans('Description') . ''; print "\n"; print ' ' . $langs->trans('OptionModeProductSell') . ''; - print '' . nl2br($langs->trans('OptionModeProductSellDesc')); + print ''.$langs->trans('OptionModeProductSellDesc'); print "\n"; print ' ' . $langs->trans('OptionModeProductBuy') . ''; - print '' . nl2br($langs->trans('OptionModeProductBuyDesc')) . "\n"; - + print ''.$langs->trans('OptionModeProductBuyDesc')."\n"; print "\n"; print '
'; @@ -277,7 +308,7 @@ if ($result) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - $texte=$langs->trans("ListOfProductsWithoutAccountingAccount"); + $texte=$langs->trans("ListOfProductsServices"); print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); print ''; @@ -285,37 +316,54 @@ if ($result) print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder); - /* - if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { - print_liste_field_titre($langs->trans("Accountancy_code_buy")); - } else { - print_liste_field_titre($langs->trans("Accountancy_code_sell")); - } - */ - print_liste_field_titre($langs->trans("AccountAccounting")); - //print_liste_field_titre($langs->trans("Modify") . '
/ ', '', '', '', '', 'align="center"'); + print_liste_field_titre($langs->trans("OnSell"), $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("OnBuy"), $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder); + if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { + $fieldtosortaccount="p.accountancy_code_buy"; + } + else $fieldtosortaccount="p.accountancy_code_sell"; + print_liste_field_titre($langs->trans("CurrentDedicatedAccountingAccount"), $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("AssignDedicatedAccountingAccount")); print_liste_field_titre('', '', '', '', '', 'align="center"'); print ''; print ''; - print ''; - print ''; - print ''; - if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print ''; + print ''; + print ''; + if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print ''; + // On sell + print ''; + // On buy + print ''; + // Current account + print ''; + print ''; print ''; print ''; - $var = true; + $product_static = new Product($db); + $var = true; + $i=0; while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - $var = ! $var; - - $compta_prodsell = $obj->accountancy_code_sell; + + // Ref produit as link + $product_static->ref = $obj->ref; + $product_static->id = $obj->rowid; + $product_static->type = $obj->product_type; + $product_static->label = $obj->label; + $product_static->description = $obj->description; + $product_static->status = $obj->tosell; + $product_static->status_buy = $obj->tobuy; if ($obj->product_type == 0) { $compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); @@ -325,8 +373,6 @@ if ($result) $compta_prodsell_id = $aarowid_servsell; } - $compta_prodbuy = $obj->accountancy_code_buy; - if ($obj->product_type == 0) { $compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodbuy_id = $aarowid_prodbuy; @@ -335,30 +381,15 @@ if ($result) $compta_prodbuy_id = $aarowid_servbuy; } - $product_static = new Product($db); - - print ''; - - print ""; - + $var = ! $var; print ''; - // Ref produit as link - $product_static->ref = $obj->ref; - $product_static->id = $obj->rowid; - $product_static->type = $obj->type; - $product_static->label = $obj->label; - $product_static->description = $obj->description; - print ''; print ''; - + if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) { // TODO ADJUST DESCRIPTION SIZE @@ -368,24 +399,43 @@ if ($result) print ''; } - // Accounting account buy + print ''; + + print ''; + + // Current accounting account + print ''; - // TODO: replace by select - // print ''; - // TODO: we shoul set a user defined value to adjust user square / wide screen size - // $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; + print length_accountg($obj->accountancy_code_buy); + if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); + } + else + { + print length_accountg($obj->accountancy_code_sell); + if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); + } + print ''; + + // Dedicated account + $defaultvalue=''; + if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { + // Accounting account buy print ''; } else { // Accounting account sell - // print ''; - // TODO: replace by select - // TODO: we shoul set a user defined value to adjust user square / wide screen size - // $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; print ''; } @@ -397,7 +447,34 @@ if ($result) } print '
 '; + print ''; + $listofvals=array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount")); + print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1); + print ' '; $searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1); print $searchpitco; print '
'; - if ($product_static->id) - print $product_static->getNomUrl(1); - else - print '- '; + print $product_static->getNomUrl(1); print ''.$obj->label.'' . nl2br(dol_trunc($obj->description, $trunclengh)) . ''.$product_static->getLibStatut(3, 0).''.$product_static->getLibStatut(3, 1).''; if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { - // print '' . $obj->accountancy_code_buy . '' . $compta_prodbuy . ''; - print $form->select_account($compta_prodbuy_id, 'codeventil_' . $product_static->id, 1); + //$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code + if (empty($defaultvalue)) $defaultvalue=$compta_prodbuy; + $codesell=length_accountg($obj->accountancy_code_buy); + if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid + print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1); print '' . $obj->accountancy_code_sell . ''; - print $form->select_account($compta_prodsell_id, 'codeventil_' . $product_static->id, 1); + //$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code + if (empty($defaultvalue)) $defaultvalue=$compta_prodsell; + $codesell=length_accountg($obj->accountancy_code_sell); + //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); + if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid + print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1); print '
'; - print '
'; + // Example : Adding jquery code + print ''; + + + print '
'; print '
'; diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index ac72df44e21..fab9e81031d 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -65,7 +65,7 @@ class FormVentilation extends Form /** * Return list of accounts with label by chart of accounts * - * @param string $selectid Preselected chart of accounts + * @param string $selectid Preselected id or code of accounting accounts (depends on $select_in) * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options @@ -99,26 +99,28 @@ class FormVentilation extends Form $out = ajax_combobox($htmlname, $event); + // TODO Add $options in cache so next call will not execute the request + $selected = 0; $options = array(); - $selected = null; - - while ($obj = $this->db->fetch_object($resql)) { + while ($obj = $this->db->fetch_object($resql)) + { $label = length_accountg($obj->account_number) . ' - ' . $obj->label; $label = dol_trunc($label, $trunclength); $select_value_in = $obj->rowid; $select_value_out = $obj->rowid; + // Try to guess if we have found default value if ($select_in == 1) { $select_value_in = $obj->account_number; } if ($select_out == 1) { $select_value_out = $obj->account_number; } - // Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number // Because same account_number can be share between different accounting_system and do have the same meaning - if (($selectid != '') && $selectid == $select_value_in) { + if ($selectid != '' && $selectid == $select_value_in) { + //var_dump("Found ".$selectid." ".$select_value_in); $selected = $select_value_out; } @@ -127,6 +129,7 @@ class FormVentilation extends Form $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); $this->db->free($resql); + return $out; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d7414a46835..e00a8a825b8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5197,7 +5197,7 @@ function dol_osencode($str) * Store also Code-Id into a cache to speed up next request on same key. * * @param DoliDB $db Database handler - * @param string $key Code to get Id + * @param string $key Code or Id to get Id or Code * @param string $tablename Table name without prefix * @param string $fieldkey Field for code * @param string $fieldid Field for id diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index d24ec11a502..9a94bf5d5c5 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -16,6 +16,8 @@ Journaux=Journals JournalFinancial=Financial journals BackToChartofaccounts=Return chart of accounts Chartofaccounts=Chart of accounts +CurrentDedicatedAccountingAccount=Current dedicated account +AssignDedicatedAccountingAccount=New account to assign AccountancyArea=Accountancy area AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: @@ -207,11 +209,15 @@ DefaultBindingDesc=This page can be used to set a default account to use to link Options=Options OptionModeProductSell=Mode sales OptionModeProductBuy=Mode purchases -OptionModeProductSellDesc=Show all products with no accounting account defined for sales. -OptionModeProductBuyDesc=Show all products with no accounting account defined for purchases. +OptionModeProductSellDesc=Show all products with accounting account for sales. +OptionModeProductBuyDesc=Show all products with accounting account for purchases. CleanFixHistory=Remove accountancy code from lines that not exists into charts of account CleanHistory=Reset all bindings for selected year +WithoutValidAccount=Without valid dedicated account +WithValidAccount=With valid dedicated account +ValueNotIntoChartOfAccount=This value of accounting account does not exist into chart of account + ## Dictionary Range=Range of accounting account Calculated=Calculated diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 27b64a4399d..9bea19a30a2 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -101,6 +101,7 @@ KeywordFilter=Keyword filter CategoryFilter=Category filter ProductToAddSearch=Search product to add NoMatchFound=No match found +ListOfProductsServices=List of products/services ProductAssociationList=List of products/services that are component of this virtual product/package ProductParentList=List of virtual products/services with this product as a component ErrorAssociationIsFatherOfThis=One of selected product is parent with current product diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 7e3f337ed3b..4755e5e5405 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3159,17 +3159,21 @@ class Product extends CommonObject if (! empty($this->label)) $label .= '
' . $langs->trans('ProductLabel') . ': ' . $this->label; - $tmptext=''; - if ($this->weight) $tmptext.="
".$langs->trans("Weight").': '.$this->weight.' '.measuring_units_string($this->weight_units,"weight"); - if ($this->length) $tmptext.="
".$langs->trans("Length").': '.$this->length.' '.measuring_units_string($this->length_units,'length'); - if ($this->surface) $tmptext.="
".$langs->trans("Surface").': '.$this->surface.' '.measuring_units_string($this->surface_units,'surface'); - if ($this->volume) $tmptext.="
".$langs->trans("Volume").': '.$this->volume.' '.measuring_units_string($this->volume_units,'volume'); - if ($tmptext) $label .= $tmptext; - if (! empty($conf->productbatch->enabled)) + if ($this->type == Product::TYPE_PRODUCT) { - $tmptext.="
".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0,2); + if ($this->weight) $label.="
".$langs->trans("Weight").': '.$this->weight.' '.measuring_units_string($this->weight_units,"weight"); + if ($this->length) $label.="
".$langs->trans("Length").': '.$this->length.' '.measuring_units_string($this->length_units,'length'); + if ($this->surface) $label.="
".$langs->trans("Surface").': '.$this->surface.' '.measuring_units_string($this->surface_units,'surface'); + if ($this->volume) $label.="
".$langs->trans("Volume").': '.$this->volume.' '.measuring_units_string($this->volume_units,'volume'); + if (! empty($conf->productbatch->enabled)) + { + $label.="
".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0,2); + } + } + if ($this->type == Product::TYPE_SERVICE) + { + // } - $label.=$tmptext; if (! empty($this->entity)) $label .= '
' . $this->show_photos($conf->product->multidir_output[$this->entity],1,1,0,0,0,80); From 614f3d82861a093b6d67cb6e3756609fa553b898 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Nov 2016 16:32:28 +0100 Subject: [PATCH 15/56] Fix param lost when saving setup --- htdocs/accountancy/admin/index.php | 66 ++++++++++++------------------ 1 file changed, 27 insertions(+), 39 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 4eb95d298c5..8f023432727 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -50,8 +50,6 @@ $action = GETPOST('action', 'alpha'); // Parameters ACCOUNTING_* and others $list = array ( - //'ACCOUNTING_LIMIT_LIST_VENTILATION', Useless, we can change value dynamically, so we use default global setup - 'ACCOUNTING_MANAGE_ZERO', 'ACCOUNTING_LENGTH_GACCOUNT', 'ACCOUNTING_LENGTH_AACCOUNT' , 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc @@ -85,13 +83,11 @@ if ($action == 'update') { $error ++; } - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { + if ($error) { setEventMessages($langs->trans("Error"), null, 'errors'); } - foreach ( $list as $constname ) { + foreach ($list as $constname) { $constvalue = GETPOST($constname, 'alpha'); if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { @@ -259,41 +255,37 @@ if (! empty($user->admin)) print ''; } print ''; + + $var = ! $var; + print ""; + print '' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . ''; + if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; + } + print ''; } // Param a user $user->rights->accountancy->chartofaccount can access -foreach ( $list as $key ) { +foreach ($list as $key) +{ $var = ! $var; - if ($key != 'ACCOUNTING_MANAGE_ZERO') - { - print ''; - // Param - $label = $langs->trans($key); - print ''.$label.''; - // Value - print ''; - print ''; - print ''; - print ''; - } - if ($key == 'ACCOUNTING_MANAGE_ZERO') - { - $var = ! $var; - print ""; - print '' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . ''; - if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } - print ''; - } + print ''; + // Param + $label = $langs->trans($key); + print ''.$label.''; + // Value + print ''; + print ''; + print ''; + print ''; } @@ -302,10 +294,6 @@ print ''; - - - - dol_fiche_end(); print '
'; From ebe3ed9ad4f905e928f64cf80ec8ae1c5cb8e160 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Nov 2016 17:48:20 +0100 Subject: [PATCH 16/56] Uniformize code --- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/compta/bank/index.php | 43 ++++++++++++++-------- htdocs/langs/en_US/accountancy.lang | 2 +- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index f786158ccbe..29f04d8f82d 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1244,7 +1244,7 @@ class Account extends CommonObject } if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' '); - $result.=$link.$this->label.$linkend; + $result.=$link.$this->ref.$linkend; return $result; } diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 7d3073d7129..21f3e581ba4 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -39,6 +39,9 @@ $show_files=GETPOST('show_files','int'); $confirm=GETPOST('confirm','alpha'); $toselect = GETPOST('toselect', 'array'); +$search_ref=GETPOST('search_ref','alpha'); +$search_label=GETPOST('search_label','alpha'); +$search_number=GETPOST('search_number','alpha'); $statut=GETPOST('statut')?GETPOST('statut', 'alpha'):'opened'; // 'all' or ''='opened' $optioncss = GETPOST('optioncss','alpha'); @@ -115,7 +118,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { $statut = 'all'; - + $search_ref=''; + $search_label=''; + $search_number=''; + $search_statut=''; } @@ -139,9 +145,11 @@ $sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b"; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bankcacount_extrafields as ef on (c.rowid = ef.fk_object)"; $sql.= " WHERE entity IN (".getEntity('bank_account', 1).")"; -if ($statut == 'opened') $sql.= " AND clos = 0"; -if ($statut == 'closed') $sql.= " AND clos = 1"; - +if ($statut == 'opened') $sql.= " AND clos = 0"; +if ($statut == 'closed') $sql.= " AND clos = 1"; +if ($search_ref != '') $sql.=natural_search('b.ref', $search_ref); +if ($search_label != '') $sql.=natural_search('b.label', $search_label); +if ($search_number != '') $sql.=natural_search('b.number', $search_number); // Add where from extra fields foreach ($search_array_options as $key => $val) { @@ -202,6 +210,9 @@ $arrayofselected=is_array($toselect)?$toselect:array(); $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($search_ref != '') $param.='&search_ref='.$search_ref; +if ($search_label != '') $param.='&search_label='.$search_label; +if ($search_number != '') $param.='&search_number='.$search_number; if ($statut != '') $param.='&statut='.$statut; if ($show_files) $param.='&show_files=' .$show_files; if ($optioncss != '') $param.='&optioncss='.$optioncss; @@ -266,8 +277,8 @@ print ''; if (! empty($arrayfields['b.ref']['checked'])) print_liste_field_titre($arrayfields['b.ref']['label'],$_SERVER["PHP_SELF"],'b.ref','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'],$_SERVER["PHP_SELF"],'b.label','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'],$_SERVER["PHP_SELF"],'b.clos','',$param,'align="center"',$sortfield,$sortorder); @@ -300,19 +311,19 @@ if (! empty($arrayfields['b.ref']['checked'])) print ''; print ''; } -// Account type -if (! empty($arrayfields['accountype']['checked'])) -{ - print ''; -} -// Ref +// Label if (! empty($arrayfields['b.label']['checked'])) { print ''; } +// Account type +if (! empty($arrayfields['accountype']['checked'])) +{ + print ''; +} // Number if (! empty($arrayfields['b.number']['checked'])) { @@ -403,10 +414,10 @@ foreach ($accounts as $key=>$type) print ''; print ''; + print ''; print ''; - print ''; print ''; print ''; - print ''; + // Status + print ''; + // print ''; @@ -442,7 +455,7 @@ foreach ($accounts as $key=>$type) $total[$acc->currency_code] += $solde; //} } -if (! $found) print ''; +if (! $found) print ''; // Total foreach ($total as $key=>$solde) { diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 9a94bf5d5c5..1619884c36f 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -169,7 +169,7 @@ DescVentilSupplier=Consult here the list of supplier invoice lines bound or not DescVentilDoneSupplier=Consult here the list of the lines of invoices supplier and their accounting account DescVentilTodoExpenseReport=Bind expense report lines not already bound with a fee accounting account DescVentilExpenseReport=Consult here the list of expense report lines bound (or not) to a fee accounting account -DescVentilExpenseReportMore=In most cases, if you use configured fees, the application will be able to make all the binding between your expense report lines and the accounting account of your chart of accounts, just in one click with the button "%s". If account was not set on fees dictionary or if you still has some lines not bound to any account, you will have to make a manual binding from the menu "%s". +DescVentilExpenseReportMore=If you setup accounting account on type of expense report lines, the application will be able to make all the binding between your expense report lines and the accounting account of your chart of accounts, just in one click with the button "%s". If account was not set on fees dictionary or if you still has some lines not bound to any account, you will have to make a manual binding from the menu "%s". DescVentilDoneExpenseReport=Consult here the list of the lines of expenses reports and their fees accounting account ValidateHistory=Bind Automatically From 0fea6f22a9d53d06214c90508a29db1c516c417d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Nov 2016 03:27:56 +0100 Subject: [PATCH 17/56] Change code to reduce need of jmobile --- htdocs/comm/mailing/list.php | 8 +- htdocs/compta/bank/index.php | 2 + htdocs/core/class/html.form.class.php | 4 +- htdocs/core/class/html.formcompany.class.php | 10 ++- htdocs/core/lib/functions.lib.php | 28 +++--- htdocs/main.inc.php | 81 +++++++++-------- htdocs/societe/soc.php | 19 ++-- htdocs/theme/eldy/style.css.php | 44 +++++++--- htdocs/theme/md/style.css.php | 91 +++++++++++++------- 9 files changed, 175 insertions(+), 112 deletions(-) diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 7542782f6e7..bd94dd83f5c 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -125,11 +125,11 @@ if ($result) print ''; print ''; // Title print ''; print ''; if (! $filteremail) print ''; @@ -145,7 +145,7 @@ if ($result) $email=new Mailing($db); - while ($i < min($num,$conf->liste_limit)) + while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 21f3e581ba4..56735d15fce 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -130,6 +130,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP * View */ +$form=new Form($db); + $title=$langs->trans('BankAccounts'); // Load array of financial accounts (opened by default) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 48126c9afed..b3e1c162102 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5555,8 +5555,8 @@ class Form //$previous_ref = $object->ref_previous?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):' ').'':''; //$next_ref = $object->ref_next?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):' ').'':''; - $previous_ref = $object->ref_previous?''.(empty($conf->dol_use_jmobile)?'<':' ').'':''.(empty($conf->dol_use_jmobile)?'<':' ').''; - $next_ref = $object->ref_next?''.(empty($conf->dol_use_jmobile)?'>':' ').'':''.(empty($conf->dol_use_jmobile)?'>':' ').''; + $previous_ref = $object->ref_previous?''.(($conf->dol_use_jmobile != 4)?'<':' ').'':''.(($conf->dol_use_jmobile != 4)?'<':' ').''; + $next_ref = $object->ref_next?''.(($conf->dol_use_jmobile != 4)?'>':' ').'':''.(($conf->dol_use_jmobile != 4)?'>':' ').''; //print "xx".$previous_ref."x".$next_ref; $ret.='
'; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index ef9141dbc94..ac800d480fc 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -358,9 +358,10 @@ class FormCompany * * @param string $selected Title preselected * @param string $htmlname Name of HTML select combo field + * @param string $morecss Add more css on SELECT element * @return string String with HTML select */ - function select_civility($selected='',$htmlname='civility_id') + function select_civility($selected='',$htmlname='civility_id',$morecss='maxwidth100') { global $conf,$langs,$user; $langs->load("dict"); @@ -374,7 +375,7 @@ class FormCompany $resql=$this->db->query($sql); if ($resql) { - $out.= ''; $out.= ''; $num = $this->db->num_rows($resql); $i = 0; @@ -724,9 +725,10 @@ class FormCompany * @param int $fieldsize Field size * @param int $disableautocomplete 1 To disable ajax autocomplete features (browser autocomplete may still occurs) * @param string $moreattrib Add more attribute on HTML input field + * @param string $morecss More css * @return string */ - function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0, $moreattrib='') + function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0, $moreattrib='',$morecss='') { global $conf; @@ -740,7 +742,7 @@ class FormCompany $out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n"; $moreattrib.=' autocomplete="off"'; } - $out.= ''."\n"; + $out.= ''."\n"; return $out; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e00a8a825b8..50f4ff30cc6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1080,9 +1080,9 @@ function fieldLabel($langkey, $fieldkey, $fieldrequired=0) global $conf, $langs; $ret=''; if ($fieldrequired) $ret.=''; - if (empty($conf->dol_use_jmobile)) $ret.=''; if ($fieldrequired) $ret.=''; return $ret; } @@ -3208,20 +3208,20 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so if ($cpt>=1) { - $pagelist.= 'dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'':'data-role="button" ').'href="'.$file.'?page=0'.$options.'">1'; - if ($cpt > 2) $pagelist.='dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'class="inactive"':'data-role="button"').'>...'; - else if ($cpt == 2) $pagelist.='dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'':'data-role="button" ').'href="'.$file.'?page=1'.$options.'">2'; + $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'':'data-role="button" ').'href="'.$file.'?page=0'.$options.'">1'; + if ($cpt > 2) $pagelist.='dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="inactive"':'data-role="button"').'>...'; + else if ($cpt == 2) $pagelist.='dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'':'data-role="button" ').'href="'.$file.'?page=1'.$options.'">2'; } do { if ($cpt==$page) { - $pagelist.= 'dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'class="active"':'data-role="button"').'>'.($page+1).''; + $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="active"':'data-role="button"').'>'.($page+1).''; } else { - $pagelist.= 'dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'':'data-role="button" ').'href="'.$file.'?page='.$cpt.$options.'">'.($cpt+1).''; + $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'':'data-role="button" ').'href="'.$file.'?page='.$cpt.$options.'">'.($cpt+1).''; } $cpt++; } @@ -3229,14 +3229,14 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so if ($cpt<$nbpages) { - if ($cpt<$nbpages-2) $pagelist.= 'dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'class="inactive"':'data-role="button"').'>...'; - else if ($cpt == $nbpages-2) $pagelist.= 'dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'':'data-role="button" ').'href="'.$file.'?page='.($nbpages-2).$options.'">'.($nbpages - 1).''; - $pagelist.= 'dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'':'data-role="button" ').'href="'.$file.'?page='.($nbpages-1).$options.'">'.$nbpages.''; + if ($cpt<$nbpages-2) $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="inactive"':'data-role="button"').'>...'; + else if ($cpt == $nbpages-2) $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'':'data-role="button" ').'href="'.$file.'?page='.($nbpages-2).$options.'">'.($nbpages - 1).''; + $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'':'data-role="button" ').'href="'.$file.'?page='.($nbpages-1).$options.'">'.$nbpages.''; } } else { - $pagelist.= 'dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'class="active"':'data-role="button"').'>'.($page+1).""; + $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="active"':'data-role="button"').'>'.($page+1).""; } } print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtml, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist @@ -3315,7 +3315,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee } if ($page > 0) { - if (empty($conf->dol_use_jmobile)) print ''; + if (($conf->dol_use_jmobile != 4)) print ''; else print '
  • '.$langs->trans("Previous").'
  • '; } if ($betweenarrows) @@ -3324,7 +3324,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee } if ($nextpage > 0) { - if (empty($conf->dol_use_jmobile)) print ''; + if (($conf->dol_use_jmobile != 4)) print ''; else print '
  • '.$langs->trans("Next").'
  • '; } if ($afterarrows) @@ -5479,7 +5479,7 @@ function printCommonFooter($zone='private') // Google Analytics (need Google module) if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID)) { - if (empty($conf->dol_use_jmobile)) + if (($conf->dol_use_jmobile != 4)) { print "\n"; print ''; - } - if (empty($conf->dol_use_jmobile) || $conf->dol_use_jmobile != 3) print ''."\n"; + // 3=??? + // 4=all pages, not only menu + $tmp=basename($_SERVER["PHP_SELF"]); + if ($tmp == 'get_menudiv.php' || $conf->dol_use_jmobile == 4) + { + if (empty($conf->dol_use_jmobile) || ($conf->dol_use_jmobile != 2 && $conf->dol_use_jmobile != 3)) + { + print ''; + } + if (empty($conf->dol_use_jmobile) || $conf->dol_use_jmobile != 3) print ''."\n"; + } } } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index accff491427..0220f775d7b 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -994,10 +994,11 @@ else if ($conf->use_javascript_ajax) { print '
    '; - print ''; + print ''; print ''; - print ''; + // Title + print ''; print ''; } @@ -1070,9 +1071,9 @@ else // Zip / Town print ''; // Country @@ -1092,15 +1093,15 @@ else // Email web print ''; - print ''; + print ''; print ''; - print ''; - + print ''; + // Skype if (! empty($conf->skype->enabled)) { print ''; - print ''; + print ''; } // Phone / Fax diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ae45643c9cb..19f1a68f0fa 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -257,6 +257,10 @@ a.tab { font-weight: bold !important; } a:link, a:visited, a:hover, a:active { font-family: ; font-weight: normal; color: rgb(); text-decoration: none; } a:hover { text-decoration: underline; color: rgb(); } +input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { + background-color: #FFF; +} + input:focus, textarea:focus, button:focus, select:focus { @@ -270,8 +274,6 @@ textarea.cke_source:focus input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { font-size: px; font-family: ; - background: #FFF; - /* color: #111; */ border: 1px solid #C0C0C0; margin: 0px 0px 0px 0px; } @@ -618,6 +620,7 @@ div.myavailability { .minwidth400imp { min-width: 400px !important; } .minwidth500imp { min-width: 500px !important; } } +.maxwidth50 { max-width: 50px; } .maxwidth100 { max-width: 100px; } .maxwidth150 { max-width: 150px; } .maxwidth200 { max-width: 200px; } @@ -630,7 +633,7 @@ div.myavailability { .titlefield { width: 25%; } .titlefieldmiddle { width: 50%; } -/* Force values for small screen */ +/* Force values for small screen 1400 */ @media only screen and (max-width: 1400px) { .titlefield { width: 30% !important; } @@ -643,6 +646,7 @@ div.myavailability { .minwidth500imp { min-width: 300px !important; } } +/* Force values for small screen 1000 */ @media only screen and (max-width: 1000px) { .maxwidthonsmartphone { max-width: 100px; } @@ -654,14 +658,26 @@ div.myavailability { .minwidth500imp { min-width: 100px !important; } } -/* Force values for small screen */ +/* Force values for small screen 570 */ @media only screen and (max-width: 570px) { - input[type=text] { min-width: 20px; } - + div.titre { + line-height: 2em; + } + + input[type=text], select, textarea { + min-width: 20px; + min-height: 1.4em; + line-height: 1.4em; + margin: .5em 0; + padding: .4em .1em; + border: 1px solid #BBB; + } + .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } + .maxwidth50onsmartphone { max-width: 50px; } .maxwidth100onsmartphone { max-width: 100px; } .maxwidth150onsmartphone { max-width: 150px; } .maxwidth200onsmartphone { max-width: 200px; } @@ -2449,7 +2465,7 @@ table.listwithfilterbefore { /* Pagination */ div.refidpadding { - padding-top: dol_use_jmobile)?'3':'7'; ?>px; + padding-top: dol_use_jmobile != 4)?'3':'7'; ?>px; } div.refid { font-weight: bold; @@ -2485,7 +2501,7 @@ div.pagination li { display: inline-block; padding-left: 0px; padding-right: 0px; -dol_use_jmobile)) { ?> +dol_use_jmobile != 4) { ?> padding-top: 6px; padding-bottom: 5px; @@ -2497,7 +2513,7 @@ div.pagination li { } div.pagination li.pagination a, div.pagination li.pagination span { -dol_use_jmobile)) { ?> +dol_use_jmobile != 4) { ?> padding: 6px 12px; margin-left: -1px; line-height: 1.42857143; @@ -2544,13 +2560,13 @@ div.pagination li.litext a:hover { background-color: transparent; background-image: none; } -dol_use_jmobile)) { ?> +dol_use_jmobile == 4) { ?> div.pagination li.litext { padding-top: 13px; vertical-align: top; } -dol_use_jmobile)) { ?> +dol_use_jmobile != 4) { ?> div.pagination li.noborder a:hover { border: none; background-color: transparent; @@ -4629,9 +4645,9 @@ img.demothumb { width: px; } select { - width: 100%; - max-width: 100px; - min-width: 50px; + width: 98%; + dol_use_jmobile)) { ?>max-width: 100px; + min-width: 40px; } div.divphotoref { padding-right: 5px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3922fbf4bef..9935c3b2231 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -163,14 +163,20 @@ $tmppart=explode(',',$colorbackhmenu1); $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); if ($tmpval <= 360) $colortextbackhmenu='FFFFFF'; else $colortextbackhmenu='000000'; + $tmppart=explode(',',$colorbackvmenu1); $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); if ($tmpval <= 360) { $colortextbackvmenu='FFFFFF'; } else { $colortextbackvmenu='000000'; } + $tmppart=explode(',',$colorbacktitle1); -$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); -if ($tmpval <= 260) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } -else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; } +if ($colortexttitle == '') +{ + $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); + if ($tmpval <= 260) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } + else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; } +} + $tmppart=explode(',',$colorbacktabcard1); $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); if ($tmpval <= 340) { $colortextbacktab='FFFFFF'; } @@ -251,6 +257,10 @@ a.tab { font-weight: bold !important; } a:link, a:visited, a:hover, a:active { font-family: ; font-weight: normal; color: rgb(); text-decoration: none; } a:hover { text-decoration: underline; color: rgb(); } +input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { + background-color: #FDFDFD; +} + input:focus, textarea:focus, button:focus, select:focus { @@ -264,7 +274,6 @@ textarea.cke_source:focus input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { font-size: px; font-family: ; - background: #FDFDFD; border: 1px solid #C0C0C0; margin: 0px 0px 0px 0px; } @@ -286,7 +295,7 @@ input.removedassigned { vertical-align: text-bottom; margin-bottom: -3px; } -input.smallpadd { +input.smallpadd { /* Used for timesheet input */ padding-left: 1px !important; padding-right: 1px !important; } @@ -304,9 +313,6 @@ span.timesheetalreadyrecorded input { select.flat, form.flat select { font-weight: normal; } -input:disabled { - background:#f4f4f4; -} .optiongrey, .opacitymedium { opacity: 0.5; } @@ -316,6 +322,10 @@ input:disabled { .opacitytransp { opacity: 0; } +select:invalid { color: gray; } +input:disabled { + background:#f4f4f4; +} input.liste_titre { box-shadow: none !important; @@ -331,6 +341,7 @@ input.removedfile { textarea:disabled { background:#f4f4f4; } +input[type=file ] { background-color: transparent; border-top: none; border-left: none; border-right: none; box-shadow: none; } input[type=checkbox] { background-color: transparent; border: none; box-shadow: none; } input[type=radio] { background-color: transparent; border: none; box-shadow: none; } input[type=image] { background-color: transparent; border: none; box-shadow: none; } @@ -600,17 +611,22 @@ div.myavailability { .clearboth { clear:both; } .hideobject { display: none; } .minwidth50 { min-width: 50px; } -.minwidth100 { min-width: 100px; } -.minwidth200 { min-width: 200px; } -.minwidth300 { min-width: 300px; } -.minwidth400 { min-width: 400px; } -.minwidth500 { min-width: 500px; } -.minwidth50imp { min-width: 50px !important; } -.minwidth100imp { min-width: 100px !important; } -.minwidth200imp { min-width: 200px !important; } -.minwidth300imp { min-width: 300px !important; } -.minwidth400imp { min-width: 400px !important; } -.minwidth500imp { min-width: 500px !important; } +/* rule to reduce top menu - 3rd reduction */ +@media only screen and (min-width: px) +{ + .minwidth100 { min-width: 100px; } + .minwidth200 { min-width: 200px; } + .minwidth300 { min-width: 300px; } + .minwidth400 { min-width: 400px; } + .minwidth500 { min-width: 500px; } + .minwidth50imp { min-width: 50px !important; } + .minwidth100imp { min-width: 100px !important; } + .minwidth200imp { min-width: 200px !important; } + .minwidth300imp { min-width: 300px !important; } + .minwidth400imp { min-width: 400px !important; } + .minwidth500imp { min-width: 500px !important; } +} +.maxwidth50 { max-width: 50px; } .maxwidth100 { max-width: 100px; } .maxwidth150 { max-width: 150px; } .maxwidth200 { max-width: 200px; } @@ -623,7 +639,7 @@ div.myavailability { .titlefield { width: 25%; } .titlefieldmiddle { width: 50%; } -/* Force values for small screen */ +/* Force values for small screen 1400 */ @media only screen and (max-width: 1400px) { .titlefield { width: 30% !important; } @@ -636,6 +652,7 @@ div.myavailability { .minwidth500imp { min-width: 300px !important; } } +/* Force values for small screen 1000 */ @media only screen and (max-width: 1000px) { .maxwidthonsmartphone { max-width: 100px; } @@ -647,12 +664,26 @@ div.myavailability { .minwidth500imp { min-width: 100px !important; } } -/* Force values for small screen */ +/* Force values for small screen 570 */ @media only screen and (max-width: 570px) { + div.titre { + line-height: 2em; + } + + input[type=text], select, textarea { + min-width: 20px; + min-height: 1.4em; + line-height: 1.4em; + margin: .5em 0; + padding: .4em .1em; + border: 1px solid #BBB; + } + .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } + .maxwidth50onsmartphone { max-width: 50px; } .maxwidth100onsmartphone { max-width: 100px; } .maxwidth150onsmartphone { max-width: 150px; } .maxwidth200onsmartphone { max-width: 200px; } @@ -2083,7 +2114,7 @@ span.butAction, span.butActionDelete { color: #ffffff !important; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #006dcc; - dol_use_jmobile)) { ?> + dol_use_jmobile != 4)) { ?> background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); @@ -2351,7 +2382,7 @@ table.listwithfilterbefore { /* Pagination */ div.refidpadding { - padding-top: dol_use_jmobile)?'3':'14'; ?>px; + padding-top: dol_use_jmobile != 4)?'3':'14'; ?>px; } div.refid { font-weight: bold; @@ -2387,7 +2418,7 @@ div.pagination li { display: inline-block; padding-left: 0px; padding-right: 0px; -dol_use_jmobile)) { ?> +dol_use_jmobile != 4)) { ?> padding-top: 6px; padding-bottom: 5px; @@ -2400,7 +2431,7 @@ div.pagination li { div.pagination li.pagination a, div.pagination li.pagination span { -dol_use_jmobile)) { ?> +dol_use_jmobile != 4) { ?> padding: 6px 12px; margin-left: -1px; line-height: 1.42857143; @@ -2427,13 +2458,13 @@ border: none; padding-left: 4px; font-weight: bold; } -dol_use_jmobile)) { ?> +dol_use_jmobile == 4) { ?> div.pagination li.litext { padding-top: 13px; vertical-align: top; } -dol_use_jmobile)) { ?> +dol_use_jmobile != 4) { ?> div.pagination li.noborder a:hover { border: none; background-color: transparent; @@ -4362,6 +4393,8 @@ border-top-right-radius: 6px; img.demothumb { box-shadow: 2px 2px 8px #888; margin-bottom: 4px; + margin-right: 20px; + margin-left: 10px; } @@ -4509,8 +4542,8 @@ img.demothumb { width: px; } select { - width: 100%; - max-width: 100px; + width: 98%; + dol_use_jmobile)) { ?>max-width: 100px; min-width: 0 !important; } div.divphotoref { From 31acffbb13e19bc9ca08ab6a72acf720560aedaf Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 10:58:55 +0100 Subject: [PATCH 18/56] error on get tva_tx on product customer price --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 6b47d5205b6..06b5f5ac4a5 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -777,7 +777,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines [0]->price); $pu_ttc = price($prodcustprice->lines [0]->price_ttc); $price_base_type = $prodcustprice->lines [0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; + $tva_tx = $prodcustprice->lines [0]->tva_tx; } } } From 06c6a1107d4945b5debd0cf38a019a763dd4db91 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 11:00:40 +0100 Subject: [PATCH 19/56] same error --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 313fef16e2c..e1e50000df3 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -730,7 +730,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines [0]->price); $pu_ttc = price($prodcustprice->lines [0]->price_ttc); $price_base_type = $prodcustprice->lines [0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; + $tva_tx = $prodcustprice->lines [0]->tva_tx; } } else From 85c57e76e098d6ded44b35f41ee19684452b200d Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 11:01:38 +0100 Subject: [PATCH 20/56] Update facture.php --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 3ee875b5d93..2bf69038e78 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1433,7 +1433,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines[0]->price); $pu_ttc = price($prodcustprice->lines[0]->price_ttc); $price_base_type = $prodcustprice->lines[0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines[0]->tva_tx; + $tva_tx = $prodcustprice->lines[0]->tva_tx; } } } From f7294d5c3f433993c60b581352ab2c5a5fb635d9 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 11:04:16 +0100 Subject: [PATCH 21/56] Update fiche-rec.php --- htdocs/compta/facture/fiche-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 33da64e3221..b5467f74a02 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -504,7 +504,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines[0]->price); $pu_ttc = price($prodcustprice->lines[0]->price_ttc); $price_base_type = $prodcustprice->lines[0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines[0]->tva_tx; + $tva_tx = $prodcustprice->lines[0]->tva_tx; } } } From 614a0f2077c871e32ed9d57dcf995450abcae96e Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 11:05:14 +0100 Subject: [PATCH 22/56] Update card.php --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 86e45ade086..3c29f4e8fca 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -494,7 +494,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines [0]->price); $pu_ttc = price($prodcustprice->lines [0]->price_ttc); $price_base_type = $prodcustprice->lines [0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; + $tva_tx = $prodcustprice->lines [0]->tva_tx; } } } From 6da82762f2f654fa38e3132ec66f94de849cc75b Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 11:09:54 +0100 Subject: [PATCH 23/56] Update card.php --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 0a493ef60bc..b4a3f8ab420 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -636,7 +636,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines [0]->price); $pu_ttc = price($prodcustprice->lines [0]->price_ttc); $price_base_type = $prodcustprice->lines [0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; + $tva_tx = $prodcustprice->lines [0]->tva_tx; } } } From 4c712866a0036d291e7cf82ab6962196383e409e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Nov 2016 13:52:24 +0100 Subject: [PATCH 24/56] FIX No tooltip if dol_no_mouse_hover is on --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index df74013fba1..b64da2c0b2d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1907,7 +1907,7 @@ if (! function_exists("llxFooter")) if (! empty($delayedhtmlcontent)) print $delayedhtmlcontent; // Wrapper to show tooltips - if ($conf->use_javascript_ajax) + if (! empty($conf->use_javascript_ajax) && empty($conf->dol_no_mouse_hover)) { print "\n\n"; print ' + @@ -52,9 +54,26 @@ if (empty($usedolheader)) } else { - $arraycss=array(); - $arrayjs=array(); - + $arraycss=array(); + $arrayjs=array(); + /* + $arraycss=array('/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css', + '/includes/jquery/plugins/datatables/extensions/Buttons/css/buttons.dataTables.min.css', + '/includes/jquery/plugins/datatables/extensions/ColReorder/css/colReorder.dataTables.min.css' + ); + $arrayjs=array('/includes/jquery/plugins/datatables/media/js/jquery.dataTables.js', + '/includes/jquery/plugins/datatables/extensions/Buttons/js/dataTables.buttons.js', + '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.colVis.min.js', + '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.html5.min.js', + '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.flash.min.js', + '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.print.min.js', + '/includes/jquery/plugins/datatables/extensions/ColReorder/js/dataTables.colReorder.min.js', + '/includes/jszip/jszip.min.js', + '/includes/pdfmake/pdfmake.min.js', + '/includes/pdfmake/vfs_fonts.js' + ); + */ + llxHeader('','','','',0,0,$arrayjs,$arraycss); } @@ -66,7 +85,8 @@ else

    This page is a sample of page using tables. It is designed to make test with
    - css (add parameter &theme=newtheme to test another theme or edit css of current theme)
    -- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 960 to enable view with jmobile)
    +- jmobile (add parameter ">dol_use_jmobile=4&dol_optimize_smallscreen=1 and switch to small screen < 1000 to enable view with jmobile)
    +- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 570 to enable with emulated jmobile)
    - no javascript / usage for bind people (add parameter ">nojs=1 to force disable javascript)
    - dataTables
    - tablednd
    @@ -79,10 +99,10 @@ This page is a sample of page using tables. It is designed to make test with
    - +
    - +
    @@ -92,10 +112,10 @@ This page is a sample of page using tables. It is designed to make test with
    - +
    - +
    @@ -105,10 +125,10 @@ This page is a sample of page using tables. It is designed to make test with

    '; - print ''; print ''; print ''; + print '
    '.$acc->getNomUrl(1).''.$acc->label.''; print $acc->type_lib[$acc->type]; print ''.$acc->bank.''.$acc->number.''; if ($acc->rappro) @@ -421,7 +432,9 @@ foreach ($accounts as $key=>$type) } else print $langs->trans("FeatureDisabled"); print ''.$acc->getLibStatut(2).''.$acc->getLibStatut(5).''; print ''.price($solde, 0, $langs, 0, 0, -1, $acc->currency_code).''; print '
    '.$langs->trans("None").'
    '.$langs->trans("None").'
    '; - print ''; + print ''; print ''; - print ''; + print ''; print '  
    '.fieldLabel('FirstName','firstname').'
    '.fieldLabel('UserTitle','civility_id').''; - print $formcompany->select_civility($object->civility_id).'
    '.fieldLabel('UserTitle','civility_id').''; + print $formcompany->select_civility($object->civility_id, 'civility_id', 'maxwidth100').'
    '.fieldLabel('Zip','zipcode').''; - print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); + print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); print ''.fieldLabel('Town','town').''; - print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); + print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); print '
    '.fieldLabel('EMail','email').(! empty($conf->global->SOCIETE_MAIL_REQUIRED)?'*':'').'
    '.fieldLabel('Web','url').'
    '.fieldLabel('Skype','skype').'
    - + - +
    diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 6b540b7c2c5..2c639df7c9d 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -692,6 +692,30 @@ div.myavailability { .minwidth500imp { min-width: 50px !important; } .titlefield { width: auto; } .titlefieldcreate { width: auto; } + + #tooltip { + position: absolute; + width: px; + } + select { + width: 98%; + dol_use_jmobile)) { ?>max-width: 100px; + min-width: 40px; + } + div.divphotoref { + padding-right: 5px; + } + img.photoref, div.photoref { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + padding: 4px; + height: 20px; + width: 20px; + object-fit: contain; + } + } .linkobject { cursor: pointer; } @@ -4640,30 +4664,6 @@ img.demothumb { div.mainmenu { min-width: 20px; } - - #tooltip { - position: absolute; - width: px; - } - select { - width: 98%; - dol_use_jmobile)) { ?>max-width: 100px; - min-width: 40px; - } - div.divphotoref { - padding-right: 5px; - } - img.photoref, div.photoref { - border: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - box-shadow: none; - padding: 4px; - height: 20px; - width: 20px; - object-fit: contain; - } - } Date: Tue, 8 Nov 2016 17:21:26 +0100 Subject: [PATCH 53/56] NEW Add type "url" as possible extrafield. --- htdocs/admin/supplier_order.php | 2 +- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture/apercu.php | 4 +- htdocs/compta/facture/prelevement.php | 4 +- htdocs/core/class/extrafields.class.php | 29 +++++++++----- htdocs/core/class/html.form.class.php | 38 +++++++++++-------- .../core/tpl/admin_extrafields_edit.tpl.php | 8 ++-- htdocs/expedition/shipment.php | 2 +- htdocs/langs/en_US/admin.lang | 3 +- htdocs/public/test/test_arrays.php | 1 - htdocs/public/test/test_forms.php | 3 +- 12 files changed, 58 insertions(+), 40 deletions(-) diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 5d0cf665d7c..5c288b9e78a 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -497,7 +497,7 @@ $var=false; print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'
    '; print $langs->trans("IfSetToYesDontForgetPermission"); print ''; - print ''; + print ''; print ''; print ''; print "\n"; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 6b47d5205b6..5af6fbe3733 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1808,7 +1808,7 @@ if ($action == 'create') // Remise dispo de type non avoir $filter = 'fk_facture_source IS NULL'; print '
    '; - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filter); + $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filter, 0, '', 1); } } if ($absolute_creditnote) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 313fef16e2c..e0e569a99b2 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2019,7 +2019,7 @@ if ($action == 'create' && $user->rights->commande->creer) } else { // Remise dispo de type remise fixe (not credit note) print '
    '; - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount); + $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount, 0, '', 1); } } if ($absolute_creditnote) { diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index 8300545cb22..258b2434f60 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -188,7 +188,7 @@ if ($id > 0 || ! empty($ref)) // Remise dispo de type remise fixe (not credit note) $filter='fk_facture_source IS NULL'; print '
    '; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount, 1); } } else @@ -220,7 +220,7 @@ if ($id > 0 || ! empty($ref)) // Remise dispo de type avoir $filter='fk_facture_source IS NOT NULL'; if (! $absolute_discount) print '
    '; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filter, $resteapayer); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filter, $resteapayer, '', 1); } } if (! $absolute_discount && ! $absolute_creditnote) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 87a27166ae8..879d5abfee4 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -263,7 +263,7 @@ if ($object->id > 0) // Remise dispo de type non avoir $filter='fk_facture_source IS NULL'; print '
    '; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer,'',1); } } if ($absolute_creditnote > 0) @@ -283,7 +283,7 @@ if ($object->id > 0) // Remise dispo de type avoir $filter='fk_facture_source IS NOT NULL'; if (! $absolute_discount) print '
    '; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer,'',1); } } if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9bed1ed9a82..5034be1c901 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -76,14 +76,15 @@ class ExtraFields 'price'=>'ExtrafieldPrice', 'phone'=>'ExtrafieldPhone', 'mail'=>'ExtrafieldMail', + 'url'=>'ExtrafieldUrl', 'select' => 'ExtrafieldSelect', 'sellist' => 'ExtrafieldSelectList', 'radio' => 'ExtrafieldRadio', 'checkbox' => 'ExtrafieldCheckBox', 'chkbxlst' => 'ExtrafieldCheckBoxFromList', 'link' => 'ExtrafieldLink', - 'separate' => 'ExtrafieldSeparator', 'password' => 'ExtrafieldPassword', + 'separate' => 'ExtrafieldSeparator', ); /** @@ -195,6 +196,9 @@ class ExtraFields } elseif($type=='mail') { $typedb='varchar'; $lengthdb='128'; + } elseif($type=='url') { + $typedb='varchar'; + $lengthdb='255'; } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox') ||($type=='chkbxlst')){ $typedb='text'; $lengthdb=''; @@ -425,6 +429,9 @@ class ExtraFields } elseif($type=='mail') { $typedb='varchar'; $lengthdb='128'; + } elseif($type=='url') { + $typedb='varchar'; + $lengthdb='255'; } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') || ($type=='checkbox') || ($type=='chkbxlst')) { $typedb='text'; $lengthdb=''; @@ -693,6 +700,10 @@ class ExtraFields //$showsize=10; $showsize = 'minwidth100imp'; } + elseif ($type == 'url') + { + $showsize='minwidth400imp'; + } else { if (round($size) < 12) @@ -738,6 +749,10 @@ class ExtraFields { $out=''; } + elseif (in_array($type, array('mail', 'phone', 'url'))) + { + $out=''; + } elseif ($type == 'text') { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -754,14 +769,6 @@ class ExtraFields } $out=''; } - elseif ($type == 'mail') - { - $out=''; - } - elseif ($type == 'phone') - { - $out=''; - } elseif ($type == 'price') { $out=' '.$langs->getCurrencySymbol($conf->currency); @@ -1238,6 +1245,10 @@ class ExtraFields { $value=dol_print_email($value); } + elseif ($type == 'url') + { + $value=dol_print_url($value,'_blank',32,1); + } elseif ($type == 'phone') { $value=dol_print_phone($value); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b3e1c162102..b5fc9fbc560 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3910,15 +3910,16 @@ class Form * * @param string $page Page URL where form is shown * @param int $selected Value pre-selected - * @param string $htmlname Nom du formulaire select. Si 'none', non modifiable. Example 'remise_id'. + * @param string $htmlname Name of SELECT component. If 'none', not changeable. Example 'remise_id'. * @param int $socid Third party id * @param float $amount Total amount available * @param string $filter SQL filter on discounts * @param int $maxvalue Max value for lines that can be selected * @param string $more More string to add + * @param int $hidelist 1=Hide list * @return void */ - function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='') + function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='', $hidelist=0) { global $conf,$langs; if ($htmlname != "none") @@ -3929,25 +3930,30 @@ class Form print '
    '; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; // If we want deposit to be substracted to payments only and not to total of final invoice - else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; + if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)); // If we want deposit to be substracted to payments only and not to total of final invoice + else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)); } else { - if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; - else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; - } - print '
    '; - $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles - if ($filter) $newfilter.=' AND ('.$filter.')'; - $nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue); - if ($nbqualifiedlines > 0) - { - print '   '; + if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)); + else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)); } + if (empty($hidelist)) print ': '; print '
    '; + if (empty($hidelist)) + { + print '
    '; + $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles + if ($filter) $newfilter.=' AND ('.$filter.')'; + $nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue); + if ($nbqualifiedlines > 0) + { + print '   '; + } + print '
    '; + } if ($more) { print '
    '; diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 6788a24baaa..881ec69190b 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -129,10 +129,10 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') ) array('varchar', 'phone', 'mail', 'select'), - 'mail'=>array('varchar', 'phone', 'mail', 'select'), - 'phone'=>array('varchar', 'phone', 'mail', 'select'), - 'select'=>array('varchar', 'phone', 'mail', 'select') + 'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select'), + 'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'), + 'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'), + 'select'=>array('varchar', 'phone', 'mail', 'url', 'select') ); if (in_array($type, array_keys($typewecanchangeinto))) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index d16cd64f0ff..fdb4bf76359 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -254,7 +254,7 @@ if ($id > 0 || ! empty($ref)) // Remise dispo de type non avoir $filter='fk_facture_source IS NULL'; print '
    '; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter, 0, '', 1); } } if ($absolute_creditnote) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 746d0ec7d77..27d86696b82 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -354,6 +354,7 @@ Boolean=Boolean (Checkbox) ExtrafieldPhone = Phone ExtrafieldPrice = Price ExtrafieldMail = Email +ExtrafieldUrl = Url ExtrafieldSelect = Select list ExtrafieldSelectList = Select from table ExtrafieldSeparator=Separator @@ -398,7 +399,7 @@ EnableAndSetupModuleCron=If you want to have this recurring invoice beeing gener ModuleCompanyCodeAquarium=Return an accountancy code built by:
    %s followed by third party supplier code for a supplier accountancy code,
    %s followed by third party customer code for a customer accountancy code. ModuleCompanyCodePanicum=Return an empty accountancy code. ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code. -Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1 validation, 2=first approval and 3=second approval if amount is enough).
    Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval is always required. +Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).
    Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required. UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than... # Modules diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 9f337d2eb5a..5eaa20003af 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -88,7 +88,6 @@ This page is a sample of page using tables. It is designed to make test with
    - jmobile (add parameter ">dol_use_jmobile=4&dol_optimize_smallscreen=1 and switch to small screen < 1000 to enable view with jmobile)
    - jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 570 to enable with emulated jmobile)
    - no javascript / usage for bind people (add parameter ">nojs=1 to force disable javascript)
    -- dataTables
    - tablednd
    diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index a697b371438..a53f812611a 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -17,7 +17,8 @@ llxHeader();

    This page is a sample of page using Dolibarr HTML widget methods. It is designed to make test with
    - css (add parameter &theme=newtheme to test another theme or edit css of current theme)
    -- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 to enable view with jmobile)
    +- jmobile (add parameter ">dol_use_jmobile=4&dol_optimize_smallscreen=1 and switch to small screen < 1000 to enable view with jmobile)
    +- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 570 to enable with emulated jmobile)
    - no javascript / usage for bind people (add parameter ">nojs=1 to force disable javascript)


    From 3346fb1c75ed4bed8e3bfbdac3f3d25ac4d9be1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Nov 2016 17:30:48 +0100 Subject: [PATCH 54/56] Fix can change type from url to other string --- htdocs/core/class/extrafields.class.php | 4 ++-- htdocs/core/tpl/admin_extrafields_edit.tpl.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 5034be1c901..8479bab7563 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1243,7 +1243,7 @@ class ExtraFields } elseif ($type == 'mail') { - $value=dol_print_email($value); + $value=dol_print_email($value,0,0,0,64,1,1); } elseif ($type == 'url') { @@ -1251,7 +1251,7 @@ class ExtraFields } elseif ($type == 'phone') { - $value=dol_print_phone($value); + $value=dol_print_phone($value, '', 0, 0, '', ' ', 1); } elseif ($type == 'price') { diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 881ec69190b..b6c43b10ce9 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -131,6 +131,7 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') ) $typewecanchangeinto=array( 'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select'), 'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'), + 'url'=>array('varchar', 'phone', 'mail', 'url', 'select'), 'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'), 'select'=>array('varchar', 'phone', 'mail', 'url', 'select') ); From d1446bb7ef56c28e6b4ce4af6845940b5a77642b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Nov 2016 19:19:30 +0100 Subject: [PATCH 55/56] NEW Show subtotal into list of linked elements --- htdocs/.gitignore | 1 + .../comm/propal/tpl/linkedobjectblock.tpl.php | 47 ++++++++----- htdocs/commande/tpl/linkedobjectblock.tpl.php | 67 ++++++++++++------- .../facture/tpl/linkedobjectblock.tpl.php | 49 +++++++++----- htdocs/core/class/html.form.class.php | 15 +++-- .../expedition/tpl/linkedobjectblock.tpl.php | 63 ++++++++++------- .../commande/tpl/linkedobjectblock.tpl.php | 49 +++++++++----- .../facture/tpl/linkedobjectblock.tpl.php | 49 +++++++++----- htdocs/langs/en_US/sendings.lang | 2 +- .../tpl/linkedobjectblock.tpl.php | 47 ++++++++----- htdocs/theme/eldy/style.css.php | 2 +- 11 files changed, 260 insertions(+), 131 deletions(-) diff --git a/htdocs/.gitignore b/htdocs/.gitignore index 608ef55d106..1650ea7e5ae 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -22,3 +22,4 @@ /cabinetmed* /webmail* /conf/conf.php +/subtotal/ diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index cc84e87ddba..dd325da7297 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -35,27 +35,44 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("propal"); +$total=0; $ilink=0; $var=true; -$total=0; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("Proposal"); ?> - getNomUrl(1); ?> - ref_client; ?> - date,'day'); ?> - rights->propale->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - + + trans("Proposal"); ?> + getNomUrl(1); ?> + ref_client; ?> + date,'day'); ?> + rights->propale->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 98e931db9f8..38efbc91ca2 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -24,41 +24,60 @@ load("orders"); +$total=0; $ilink=0; $var=true; -$total=0; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("CustomerOrder"); ?> - getNomUrl(1); ?> - ref_client; ?> - date,'day'); ?> - rights->commande->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - - element != 'shipping') { - ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - - - + + trans("CustomerOrder"); ?> + getNomUrl(1); ?> + ref_client; ?> + date,'day'); ?> + rights->commande->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + + element != 'shipping') { + ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + + + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + \ No newline at end of file diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 56e8645b8c7..16aa54e229d 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -24,32 +24,51 @@ load("bills"); +$total=0; $ilink=0; $var=true; -$total=0; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("CustomerInvoice"); ?> - getNomUrl(1); ?> - ref_client; ?> - date,'day'); ?> - rights->facture->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - + + trans("CustomerInvoice"); ?> + getNomUrl(1); ?> + ref_client; ?> + date,'day'); ?> + rights->facture->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + \ No newline at end of file diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b5fc9fbc560..8a6c97e794c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5215,7 +5215,7 @@ class Form if (empty($reshook)) { - $num = count($object->linkedObjects); + $nbofdifferenttypes = count($object->linkedObjects); print '
    '; print load_fiche_titre($langs->trans('RelatedObjects'), $morehtmlright, ''); @@ -5232,7 +5232,7 @@ class Form print ''; print ''; - $numoutput=0; + $nboftypesoutput=0; foreach($object->linkedObjects as $objecttype => $objects) { @@ -5292,23 +5292,28 @@ class Form $dirtpls=array_merge($conf->modules_parts['tpl'],array('/'.$tplpath.'/tpl')); foreach($dirtpls as $reldir) { + if ($nboftypesoutput == ($nbofdifferenttypes - 1)) // No more type to show after + { + global $noMoreLinkedObjectBlockAfter; + $noMoreLinkedObjectBlockAfter=1; + } $res=@include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); if ($res) { - $numoutput++; + $nboftypesoutput++; break; } } } - if (! $numoutput) + if (! $nboftypesoutput) { print ''.$langs->trans("None").''; } print ''; - return $num; + return $nbofdifferenttypes; } } diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 276eb5ed8fa..f66ff148d66 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -29,35 +29,52 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("sendings"); -$total=0; +$total=0; $ilink=0; $var=true; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("Shipment"); ?> - getNomUrl(1); ?> - - date_delivery,'day'); ?> - rights->expedition->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - - element != 'commande') { - ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - - + + trans("Shipment"); ?> + getNomUrl(1); ?> + + date_delivery,'day'); ?> + rights->expedition->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + + element != 'commande') { + ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index 4cb232add74..5afde3a4427 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -23,32 +23,49 @@ load("orders"); -$total=0; +$total=0; $ilink=0; $var=true; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("SupplierOrder"); ?> - trans("ShowOrder"),"order").' '.$objectlink->ref; ?> - ref_supplier; ?> - date,'day'); ?> - rights->fournisseur->commande->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - -"> + trans("SupplierOrder"); ?> + trans("ShowOrder"),"order").' '.$objectlink->ref; ?> + ref_supplier; ?> + date,'day'); ?> + rights->fournisseur->commande->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 6762d836d52..4df741b8ad4 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -24,32 +24,49 @@ load("bills"); -$total=0; +$total=0; $ilink=0; $var=true; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("SupplierInvoice"); ?> - trans("ShowBill"),"bill").' '.$objectlink->ref; ?> - ref_supplier; ?> - date,'day'); ?> - rights->fournisseur->facture->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - -"> + trans("SupplierInvoice"); ?> + trans("ShowBill"),"bill").' '.$objectlink->ref; ?> + ref_supplier; ?> + date,'day'); ?> + rights->fournisseur->facture->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index cbbeb092a1a..b85b61bc334 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -23,7 +23,7 @@ QtyReceived=Qty received QtyInOtherShipments=Qty in other shipments KeepToShip=Remain to ship OtherSendingsForSameOrder=Other shipments for this order -SendingsAndReceivingForSameOrder=Shipments and receivings for this order +SendingsAndReceivingForSameOrder=Shipments and receipts for this order SendingsToValidate=Shipments to validate StatusSendingCanceled=Canceled StatusSendingDraft=Draft diff --git a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php index 8f72744486a..8ba1f958918 100644 --- a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php @@ -28,27 +28,44 @@ global $user; $langs = $GLOBALS['langs']; $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; +$total=0; $ilink=0; $var=true; -$total=0; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("SupplierProposal"); ?> - trans("ShowSupplierProposal"),"supplier_proposal").' '.$objectlink->ref; ?> - - datec,'day'); ?> - rights->supplier_proposal->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - + + trans("SupplierProposal"); ?> + trans("ShowSupplierProposal"),"supplier_proposal").' '.$objectlink->ref; ?> + + datec,'day'); ?> + rights->supplier_proposal->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 2c639df7c9d..f1368099864 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2859,7 +2859,7 @@ form.liste_total div { border-top: 1px solid #DDDDDD; } tr.liste_sub_total, tr.liste_sub_total td { - border-bottom: 2px solid #aaa; + border-bottom: 1px solid #aaa; } .tableforservicepart1 .impair, .tableforservicepart1 .pair, .tableforservicepart2 .impair, .tableforservicepart2 .pair { From 52080fb917914760054b2a8265a6ae2ff17fc75f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Nov 2016 20:06:50 +0100 Subject: [PATCH 56/56] Fix code not reachable --- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 2 -- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index ece59790fc3..dab925eef1d 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -580,8 +580,6 @@ class pdf_rouget extends ModelePdfExpedition $this->error=$langs->transnoentities("ErrorConstantNotDefined","EXP_OUTPUTDIR"); return 0; } - $this->error=$langs->transnoentities("ErrorUnknown"); - return 0; // Erreur par defaut } /** diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0c57cf644bc..1701f82c47b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -691,8 +691,6 @@ class pdf_crabe extends ModelePDFFactures $this->error=$langs->transnoentities("ErrorConstantNotDefined","FAC_OUTPUTDIR"); return 0; } - $this->error=$langs->transnoentities("ErrorUnknown"); - return 0; // Erreur par defaut }