diff --git a/ChangeLog b/ChangeLog index 7f210c6fab1..0f2ed877a13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,19 +26,19 @@ Dolibarr better: - The old driver of "mysql" has been removed. Dolibarr use the new one (mysqli) by default. - Remove not used function calculate_byte(). Use dol_print_size() instead. - Function pdf_getTotalQty is now deprecated. Not used by Dolibarr core. +- Method commande->deleteline($lineid) has been replaced with commande->deleteline($user, $lineid). - Method expensereport->delete(id, user) has been replaced with ->delete(user) Method warehouse->delete(id) has been replace with ->delete(user) This is to follow good practice to make a fetch on object before deleting it. -- The form to add a product to a draft proposal/order/invoice from the product card is hidden by default. +- The form to add a product to a draft proposal/order/invoice, from the product card, is hidden by default. It was not commonly used and usage generates some problems (cost price for margin calculation not entered, vat setting). Set constant PRODUCT_ADD_FORM_ADD_TO to retrieve it. -- The javascript "datatables" library was used to be provided into Dolibarr sources, but it was not used by application. +- The javascript "datatables" library was previously provided into Dolibarr sources, but it was not used by application. So there is no reason to maintain its compatibility with other dolibarr components. If an external module need this - library, this external module must embed hte library in his own sources/packages. -- Trigger name SUPPLIER_PROPOSAL_CREATE has been renamed into PROPOSAL_SUPPLIER_CREATE -- A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters - no more required were also removed. Use this new one if you ware using one of them. -- Method commande->deleteline($lindeid) has been replaced with commande->deleteline($user, $lineid). + library, this external module must embed the library in his own sources/packages. +- Trigger name SUPPLIER_PROPOSAL_CREATE has been renamed into PROPOSAL_SUPPLIER_CREATE. +- A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters, + no more required, were also removed. Use this new one if you were using one of them. diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 27515db3c68..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'); @@ -141,22 +142,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 +182,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 @@ -247,301 +248,308 @@ 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) +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) && $search_all) +{ + $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/.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/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/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 720f3a4f012..99b491688cb 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -40,6 +40,22 @@ $langs->load("accountancy"); if (! $user->admin) accessforbidden(); +$limit = GETPOST("limit")?GETPOST("limit","int"):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; + + + + +/* + * View + */ + llxHeader('', $langs->trans("ImportAccount")); $to_import = GETPOST("mesCasesCochees"); @@ -90,15 +106,7 @@ if ($_POST["action"] == 'import') { print '
' . $langs->trans("EndProcessing") . '
'; } -/* - * list accounting account from product - * - */ -$page = GETPOST("page"); -if ($page < 0) - $page = 0; -$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; -$offset = $limit * $page; +// list accounting account from product $sql = "(SELECT p.rowid as product_id, p.accountancy_code_sell as accounting "; $sql .= " FROM " . MAIN_DB_PREFIX . "product as p "; 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 '
'; 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/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index d33fc82f3bc..b18923a1e1d 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -83,7 +83,7 @@ $formventilation = new FormVentilation($db); */ // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $search_ref = ''; $search_invoice = ''; @@ -254,6 +254,7 @@ if ($result) { print ''."\n"; print ''; + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); 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); @@ -263,21 +264,20 @@ if ($result) { print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre('', '', '', '', '', 'align="center"'); print "\n"; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; print ''; + print ''; + // Ref Invoice $facture_static->ref = $objp->facnumber; $facture_static->id = $objp->rowid; @@ -319,7 +321,6 @@ if ($result) { print ''; print ''; print ''; - print ''; print ''; print ""; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 7c718c54bfb..84d5e3ffdee 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -158,9 +158,10 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { llxHeader('', $langs->trans("Ventilation")); // Customer Invoice lines -$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line,"; +$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,"; +$sql .= " l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,"; -$sql .= " aa.rowid as aarowid"; +$sql .= " aa.rowid as aarowid"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; @@ -237,6 +238,7 @@ if ($result) { print '
'; $searchpitco=$form->showFilterAndCheckAddButtons(1); print $searchpitco; @@ -293,6 +293,8 @@ if ($result) { print '
' . $objp->rowid . '' . $objp->country .'' . $objp->tva_intra . '' . $objp->rowid . '
'."\n"; print ''; + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); 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); @@ -245,19 +247,18 @@ if ($result) { print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"'); print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre('', '', '', '', '', 'align="center"'); print ''; // We add search filter print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; + // Line id + print ''; + // Ref Invoice $facture_static->ref = $objp->facnumber; $facture_static->id = $objp->facid; $facture_static->type = $objp->ftype; print ''; + // Ref Product $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; @@ -327,9 +330,9 @@ if ($result) { print ''; - print ''; + print ''; $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; - print ''; + print ''; print ''; - // Accounting account suggested + // Suggested accounting account print ''; @@ -358,9 +359,6 @@ if ($result) { print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1); print ''; - // Line id - print ''; - print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 9720aba485d..14a3d69a4ea 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -230,24 +230,25 @@ if ($result) { print '
%%'; @@ -278,42 +279,44 @@ if ($result) { $objp->code_sell_l = ''; $objp->code_sell_p = ''; $objp->aarowid_suggest = ''; - $code_sell_p_l_differ = ''; $code_sell_p_notset = ''; $objp->aarowid_suggest = $objp->aarowid; - if (! empty($objp->code_sell)) { - $objp->code_sell_p = $objp->code_sell; - } else { - $code_sell_p_notset = 'color:red'; - if ($objp->type == 1) { - $objp->code_sell_p = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); - } elseif ($objp->type == 0) { - $objp->code_sell_p = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); - } - } if ($objp->type_l == 1) { - $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); if ($objp->aarowid == '') { $objp->aarowid_suggest = $aarowid_s; } } elseif ($objp->type_l == 0) { - $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); if ($objp->aarowid == '') { $objp->aarowid_suggest = $aarowid_p; } } - if ($objp->code_sell_l != $objp->code_sell_p) - $code_sell_p_l_differ = 'color:red'; + if ($objp->code_sell_l == -1) $objp->code_sell_l=''; + if (! empty($objp->code_sell)) { + $objp->code_sell_p = $objp->code_sell; // Code on product + } else { + $code_sell_p_notset = 'color:orange'; + } + if (empty($objp->code_sell_l) && empty($objp->code_sell_p)) $code_sell_p_notset = 'color:red'; + + // $objp->code_sell_p is now code of product/service + // $objp->code_sell_l is now default code of product/service + print '
' . $objp->rowid . '' . $facture_static->getNomUrl(1) . '' . dol_trunc($objp->product_label, 24) . '' . dol_trunc($objp->product_label, 24) . '' . nl2br(dol_trunc($objp->description, $trunclength)) . '' . nl2br(dol_trunc($objp->description, $trunclength)) . ''; print price($objp->total_ht); @@ -342,15 +345,13 @@ if ($result) { print price($objp->tva_tx_line); print ''; - if ($objp->code_sell_l == $objp->code_sell_p) { // Test if there is a difference between code by default and code on product - if ($objp->code_sell_l > 0) print $objp->code_sell_l; - else print $langs->trans("Unknown"); - } else { - print $langs->trans("Default") . ' = ' . ($objp->code_sell_l > 0 ? $objp->code_sell_l : $langs->trans("Unknown")); - print '
'; - print $langs->trans("Product") . ' = ' . ($objp->code_sell_p > 0 ? $objp->code_sell_p : $langs->trans("Unknown")); + print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown")); + if ($objp->product_id > 0) + { + print '
'; + print (($objp->type_l == 1)?$langs->trans("ThisService"):$langs->trans("ThisProduct")) . ' = ' . (empty($objp->code_sell_p) ? $langs->trans("Unknown") : length_accountg($objp->code_sell_p)); } print '
' . $objp->rowid . ''; print 'aarowid ? "checked" : "") . '/>'; print '
'."\n"; print ''; + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre(''); print_liste_field_titre('', '', '', '', '', 'align="center"'); print "\n"; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; - print ''; - print ''; + print ''; print ''; print ''; + print ''; + // Ref Invoice $expensereport_static->ref = $objp->ref; $expensereport_static->id = $objp->erid; @@ -281,8 +284,6 @@ if ($result) { print ''; - print ''; - print ''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 943105a00fa..b9e929cab04 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -233,6 +233,7 @@ if ($result) { print '
'; $searchpicto=$form->showFilterAndCheckAddButtons(1); @@ -265,6 +266,8 @@ if ($result) { print '
' . $objp->rowid . '' . $codeCompta . '' . $objp->rowid . ''; print img_edit(); print '
'."\n"; print ''; + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); @@ -240,19 +241,18 @@ if ($result) { print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"'); print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre('', '', '', '', '', 'align="center"'); print "\n"; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; print ''; - print ''; print ''; + // Line id + print ''; + // Ref Expense report $expensereport_static->ref = $objp->ref; $expensereport_static->id = $objp->erid; @@ -306,9 +309,6 @@ if ($result) { print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1); print ''; - // Line id - print ''; - // Colonne choix ligne a ventiler print ''."\n"; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { $var=!$var; + print ''; print ''."\n"; print ''."\n"; print ''."\n"; @@ -384,7 +385,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; // AGENDA_DEFAULT_FILTER_STATUS @@ -393,7 +394,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; // AGENDA_DEFAULT_VIEW diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index bf4a09c0ada..859534d53fd 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -87,14 +87,14 @@ else if ($action == 'disable_delivery') $dir = DOL_DOCUMENT_ROOT."/core/modules/expedition/"; $form=new Form($db); -llxHeader("",""); +llxHeader("",$langs->trans("SendingsSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("SendingsSetup"),$linkback,'title_setup'); print '
'; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'general', $langs->trans("ModuleSetup"), 0, 'sending'); +dol_fiche_head($head, 'general', $langs->trans("Sendings"), 0, 'sending'); /* * Formulaire parametres divers diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 42741b49c7a..34a561121b2 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -215,7 +215,7 @@ $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); $form=new Form($db); -llxHeader("",""); +llxHeader("",$langs->trans("SendingsSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("SendingsSetup"),$linkback,'title_setup'); 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 '\n"; diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index 365cfaa449d..ff7a16d1893 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -88,7 +88,7 @@ else { $arraytest=array( 'character_set_database'=>array('var'=>'dolibarr_main_db_character_set','valifempty'=>'utf8'), - 'collation_database'=>array('var'=>'dolibarr_main_db_collation','valifempty'=>'utf8_general_ci') + 'collation_database'=>array('var'=>'dolibarr_main_db_collation','valifempty'=>'utf8_unicode_ci') ); } diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index eeea93a2fea..2fe87a02e63 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -40,20 +40,22 @@ if (! $user->admin) $form=new Form($db); -llxHeader(); +$title=$langs->trans("InfoDolibarr"); -print load_fiche_titre($langs->trans("InfoDolibarr"),'','title_setup'); +llxHeader('', $title); + +print load_fiche_titre($title,'','title_setup'); // Version $var=true; print '
'; $searchpicto=$form->showFilterAndCheckAddButtons(1); print $searchpicto; @@ -272,6 +272,9 @@ if ($result) { print '
' . $objp->rowid . '' . $objp->rowid . ''; print 'aarowid ? "checked" : "") . '/>'; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 94af5c82dba..09422eb5b93 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -82,7 +82,7 @@ $formventilation = new FormVentilation($db); */ // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $search_ref = ''; $search_invoice = ''; @@ -237,6 +237,7 @@ if ($result) { print ''."\n"; print ''; + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); 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); @@ -244,20 +245,20 @@ if ($result) { print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre(''); print_liste_field_titre('', '', '', '', '', 'align="center"'); print "\n"; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; - print ''; print ''; + print ''; + // Ref Invoice $facturefournisseur_static->ref = $objp->facnumber; $facturefournisseur_static->id = $objp->facid; @@ -297,7 +300,6 @@ if ($result) { print ''; print ''; print ''; - print ''; print ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index bd0dac49096..e103c35810a 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -164,9 +164,10 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { llxHeader('', $langs->trans("SuppliersVentilation")); // Supplier Invoice Lines -$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, f.datef, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, "; -$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod"; -$sql .= " , aa.rowid as aarowid"; +$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, f.datef,"; +$sql .= " l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, "; +$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,"; +$sql .= " aa.rowid as aarowid"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; @@ -243,6 +244,7 @@ if ($result) { print '
'; $searchpitco=$form->showFilterAndCheckAddButtons(1); print $searchpitco; @@ -275,6 +276,8 @@ if ($result) { print '
' . $objp->rowid . '' . price($objp->total_ht) . '' . price($objp->tva_tx) . '' . $codeCompta . '' . $objp->rowid . ''; print img_edit(); print '
'."\n"; print ''; + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); 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); @@ -251,20 +253,19 @@ if ($result) { print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"'); print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre('', '', '', '', '', 'align="center"'); print "\n"; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; print ''; - print ''; print ''; + // Line id + print ''; + // Ref Invoice $facturefourn_static->ref = $objp->ref; $facturefourn_static->id = $objp->facid; @@ -335,11 +333,11 @@ if ($result) { print ' '; print ''; - print ''; + print ''; // TODO: we should set a user defined value to adjust user square / wide screen size $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; - print ''; + print ''; print ''; - // Colonne choix du compte + // Suggested accounting account print ''; - // Line id - print ''; - // Colonne choix ligne a ventiler 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 "
'; $searchpitco=$form->showFilterAndCheckAddButtons(1); print $searchpitco; @@ -286,39 +287,36 @@ if ($result) { $objp->code_buy_l = ''; $objp->code_buy_p = ''; $objp->aarowid_suggest = ''; - $code_buy_p_l_differ = ''; $code_buy_p_notset = ''; - $objp->aarowid_suggest = $objp->aarowid; - if (! empty($objp->code_buy)) { - $objp->code_buy_p = $objp->code_buy; - } else { - $code_buy_p_notset = 'color:red'; - if ($objp->type == 1) { - $objp->code_buy_p = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); - } - - elseif ($objp->type == 0) { - $objp->code_buy_p = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); - } - } if ($objp->type_l == 1) { - $objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); + $objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : ''); if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s; } elseif ($objp->type_l == 0) { - $objp->code_buy_l = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); + $objp->code_buy_l = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : ''); if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_p; } - - if ($objp->code_buy_l != $objp->code_buy_p) - $code_buy_p_l_differ = 'color:red'; + if ($objp->code_buy_l == -1) $objp->code_buy_l=''; + if (! empty($objp->code_buy)) { + $objp->code_buy_p = $objp->code_buy; + } else { + $code_buy_p_notset = 'color:orange'; + } + if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) $code_buy_p_notset = 'color:red'; + + // $objp->code_buy_p is now code of product/service + // $objp->code_buy_l is now default code of product/service + print '
' . $objp->rowid . '' . dol_trunc($objp->product_label, 24) . '' . dol_trunc($objp->product_label, 24) . '' . nl2br(dol_trunc($objp->description, $trunclength)) . '' . nl2br(dol_trunc($objp->description, $trunclength)) . ''; print price($objp->price); @@ -354,24 +352,19 @@ if ($result) { // Accounting account suggested print ''; - if ($objp->code_buy_l == $objp->code_buy_p) { // Test if there is a difference between code by default and code on product - if ($objp->code_buy_l > 0) print $objp->code_buy_l; - else print $langs->trans("Unknown"); - } else { - print $langs->trans("Default") . ' = ' . ($objp->code_buy_l > 0 ? $objp->code_buy_l : $langs->trans("Unknown")); + print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("Unknown")); + if ($objp->product_id > 0) + { print '
'; - print $langs->trans("Product") . ' = ' . ($objp->code_buy_p > 0 ? $objp->code_buy_p : $langs->trans("Unknown")); + print (($objp->type_l == 1)?$langs->trans("ThisService"):$langs->trans("ThisProduct")) . ' = ' . (empty($objp->code_buy_p) ? $langs->trans("Unknown") : length_accountg($objp->code_buy_p)); } print '
'; print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1); print '' . $objp->rowid . ''; print 'aarowid ? "checked" : "") . '/>'; 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 d3e7e96a793..0727002aa59 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,5); 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 "
\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/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 9ea048c27fd..e6bb4a2914f 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -1,9 +1,9 @@ +/* Copyright (C) 2008-2016 Laurent Destailleur * Copyright (C) 2011 Regis Houssin - * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Charlie Benke * * 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 @@ -28,7 +28,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; if (!$user->admin) accessforbidden(); @@ -370,6 +370,7 @@ print '
'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").' 
'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").' '."\n"; -$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), 1); +$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1); print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").' '."\n"; -$formactions->form_select_status_action('agenda',$conf->global->AGENDA_DEFAULT_FILTER_STATUS,1,'AGENDA_DEFAULT_FILTER_STATUS',1,2); +$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2); print '
'; - print ''; + print ''; print ''; print ''; print "
'; -print ''."\n"; +print ''."\n"; $var=!$var; -print ''."\n"; +print ''."\n"; $var=!$var; -print ''."\n"; +print ''."\n"; $var=!$var; -print ''; } diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 4b0ae91ee3f..3914b59b9f6 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -322,7 +322,8 @@ function ajax_dialog($title,$message,$w=350,$h=150) { global $langs; - $msg= '
'; + $newtitle=dol_textishtml($title)?dol_string_nohtmltag($title,1):$title; + $msg= '
'; $msg.= $message; $msg.= '
'."\n"; $msg.= ''; - } - 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"; + } } } @@ -1878,7 +1887,7 @@ if (! function_exists("llxFooter")) print '
'.$msg.'
'; } - define("MAIN_CORE_ERROR",0); + //define("MAIN_CORE_ERROR",0); // Constant was defined and we can't change value of a constant } print "\n\n"; @@ -1898,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,9 +85,9 @@ 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 +98,10 @@ This page is a sample of page using tables. It is designed to make test with
- +
- +
@@ -92,10 +111,10 @@ This page is a sample of page using tables. It is designed to make test with
- +
- +
@@ -105,10 +124,10 @@ This page is a sample of page using tables. It is designed to make test with
'.$langs->trans("Version").''.$langs->trans("Value").'
'.$langs->trans("Version").''.$langs->trans("Value").'
'.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.'
'.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.'
'.$langs->trans("VersionLastUpgrade").''.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'.$langs->trans("VersionLastUpgrade").''.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'.$langs->trans("VersionProgram").''.DOL_VERSION; +print '
'.$langs->trans("VersionProgram").''.DOL_VERSION; // If current version differs from last upgrade if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) { @@ -72,30 +74,30 @@ print '
'; // Session $var=true; print ''; -print ''."\n"; +print ''."\n"; $var=!$var; -print ''."\n"; +print ''."\n"; $var=!$var; -print ''."\n"; +print ''."\n"; $var=!$var; -print ''."\n"; +print ''."\n"; $var=!$var; -print '\n"; $var=!$var; -print ''."\n"; +print ''."\n"; $var=!$var; -print ''."\n"; $var=!$var; -print ''."\n"; $var=!$var; -print ''; + if ($outputalsopricetotalwithtax) print ''; + print ''; // No width to allow autodim print ''; @@ -4444,12 +4446,12 @@ abstract class CommonObject } if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { - $out .= ''; + $out .= ''; $colspan='0'; } else { - $out .= ''; + $out .= ''; } // Convert date into timestamp format if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9bed1ed9a82..8479bab7563 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); @@ -1236,11 +1243,15 @@ class ExtraFields } elseif ($type == 'mail') { - $value=dol_print_email($value); + $value=dol_print_email($value,0,0,0,64,1,1); + } + elseif ($type == 'url') + { + $value=dol_print_url($value,'_blank',32,1); } elseif ($type == 'phone') { - $value=dol_print_phone($value); + $value=dol_print_phone($value, '', 0, 0, '', ' ', 1); } elseif ($type == 'price') { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 48126c9afed..8a6c97e794c 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 '
'; @@ -5209,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, ''); @@ -5226,7 +5232,7 @@ class Form print '
'; print ''; - $numoutput=0; + $nboftypesoutput=0; foreach($object->linkedObjects as $objecttype => $objects) { @@ -5286,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 ''; } print '
'.$langs->trans("Session").''.$langs->trans("Value").'
'.$langs->trans("Session").''.$langs->trans("Value").'
'.$langs->trans("SessionSavePath").''.session_save_path().'
'.$langs->trans("SessionSavePath").''.session_save_path().'
'.$langs->trans("SessionName").''.session_name().'
'.$langs->trans("SessionName").''.session_name().'
'.$langs->trans("SessionId").''.session_id().'
'.$langs->trans("SessionId").''.session_id().'
'.$langs->trans("CurrentSessionTimeOut").''.ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds"); +print '
'.$langs->trans("CurrentSessionTimeOut").''.ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds"); print ''; print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); print "
'.$langs->trans("CurrentTheme").''.$conf->theme.'
'.$langs->trans("CurrentTheme").''.$conf->theme.'
'.$langs->trans("CurrentMenuHandler").''; +print '
'.$langs->trans("CurrentMenuHandler").''; print $conf->standard_menu; print '
'.$langs->trans("Screen").''; +print '
'.$langs->trans("Screen").''; print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; print '
'.$langs->trans("Session").''; +print '
'.$langs->trans("Session").''; $i=0; foreach($_SESSION as $key => $val) { @@ -116,7 +118,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S $var=true; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''."\n"; @@ -124,7 +126,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S foreach($shmoparray as $key => $val) { $var=!$var; - print ''; + print ''; print ''; print ''; print ''."\n"; @@ -138,41 +140,41 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S // Localisation $var=true; print '
'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").''.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").''.$langs->trans("NbOfEntries").''.$langs->trans("Address").'
'.$key.'
'.$key.''.count($val).''.dol_getshmopaddress($key).'
'; -print ''."\n"; +print ''."\n"; $var=!$var; -print ''."\n"; +print ''."\n"; $var=!$var; -print ''."\n"; +print ''."\n"; // Thousands $var=!$var; $thousand=$langs->transnoentitiesnoconv("SeparatorThousand"); if ($thousand == 'SeparatorThousand') $thousand=' '; // ' ' does not work on trans method if ($thousand == 'None') $thousand=''; -print ''."\n"; +print ''."\n"; // Decimals $var=!$var; $dec=$langs->transnoentitiesnoconv("SeparatorDecimal"); -print ''."\n"; +print ''."\n"; // Show results of functions to see if everything works $var=!$var; -print ''."\n"; +print ''."\n"; $var=!$var; -print "\n"; +print "\n"; if (($thousand != ',' && $thousand != '.') || ($thousand != ' ')) { $var=!$var; - print ""; + print ""; print "\n"; } $var=!$var; -print ''."\n"; +print ''."\n"; // Timezone $txt =$langs->trans("OSTZ").' (variable system TZ): '.(! empty($_ENV["TZ"])?$_ENV["TZ"]:$langs->trans("NotDefined")).'
'."\n"; $txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."
\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $txt.=$langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ)?$langs->trans("NotDefined"):$conf->global->MAIN_SERVER_TZ); //$txt.=$langs->trans("YouCanEditPHPTZ"); // deprecated $var=!$var; -print ''."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php $var=!$var; -print ''."\n"; +print ''."\n"; $var=!$var; -print ''; +print ''; $var=!$var; -print ''; +print ''; $var=!$var; -print ''; +print ''; // Database timezone if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') { $var=!$var; - print ''."\n"; print ''."\n"; $var=!$var; -print ''."\n"; +print ''."\n"; $var=!$var; $filesystemencoding=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 -print ''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php +print ''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $var=!$var; $tmp=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 if (empty($tmp) && ! empty($_SERVER["WINDIR"])) $tmp='iso-8859-1'; // By default for windows if (empty($tmp)) $tmp='utf-8'; // By default for other if (! empty($conf->global->MAIN_FILESYSTEM_ENCODING)) $tmp=$conf->global->MAIN_FILESYSTEM_ENCODING; -print ''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php +print ''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php print '
'.$langs->trans("LocalisationDolibarrParameters").''.$langs->trans("Value").'
'.$langs->trans("LocalisationDolibarrParameters").''.$langs->trans("Value").'
'.$langs->trans("LanguageBrowserParameter","HTTP_ACCEPT_LANGUAGE").''.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'
'.$langs->trans("LanguageBrowserParameter","HTTP_ACCEPT_LANGUAGE").''.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'
'.$langs->trans("CurrentUserLanguage").''.$langs->getDefaultLang().'
'.$langs->trans("CurrentUserLanguage").''.$langs->getDefaultLang().'
'.$langs->trans("CurrentValueSeparatorThousand").''.($thousand==' '?$langs->transnoentitiesnoconv("Space"):$thousand).'
'.$langs->trans("CurrentValueSeparatorThousand").''.($thousand==' '?$langs->transnoentitiesnoconv("Space"):$thousand).'
'.$langs->trans("CurrentValueSeparatorDecimal").''.$dec.'
'.$langs->trans("CurrentValueSeparatorDecimal").''.$dec.'
  => price2num(1233.56+1)'.price2num(1233.56+1,'2').'
  => price2num(1233.56+1)'.price2num(1233.56+1,'2').'
  => price2num('."'1".$thousand."234".$dec."56')".price2num("1".$thousand."234".$dec."56",'2')."
  => price2num('."'1".$thousand."234".$dec."56')".price2num("1".$thousand."234".$dec."56",'2')."
  => price2num('."'1 234.56')".price2num("1 234.56",'2')."
  => price2num('."'1 234.56')".price2num("1 234.56",'2')."
  => price(1234.56)'.price(1234.56).'
  => price(1234.56)'.price(1234.56).'
'.$langs->trans("CurrentTimeZone").''; // Timezone server PHP +print '
'.$langs->trans("CurrentTimeZone").''; // Timezone server PHP $a=getServerTimeZoneInt('now'); $b=getServerTimeZoneInt('winter'); $c=getServerTimeZoneInt('summer'); @@ -185,18 +187,18 @@ $val.='       '.$langs->trans("DaylingSavingTime").': '.($dayligh print $form->textwithtooltip($val,$txt,2,1,img_info('')); print '
  => '.$langs->trans("CurrentHour").''.dol_print_date(dol_now(),'dayhour','tzserver').'
  => '.$langs->trans("CurrentHour").''.dol_print_date(dol_now(),'dayhour','tzserver').'
  => dol_print_date(0,"dayhourtext")'.dol_print_date(0,"dayhourtext").'
  => dol_print_date(0,"dayhourtext")'.dol_print_date(0,"dayhourtext").'
  => dol_get_first_day(1970,1,false)'.dol_get_first_day(1970,1,false).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,false),'dayhour').')
  => dol_get_first_day(1970,1,false)'.dol_get_first_day(1970,1,false).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,false),'dayhour').')
  => dol_get_first_day(1970,1,true)'.dol_get_first_day(1970,1,true).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')
  => dol_get_first_day(1970,1,true)'.dol_get_first_day(1970,1,true).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')
'.$langs->trans("MySQLTimeZone").' (database)'; // Timezone server base + print '
'.$langs->trans("MySQLTimeZone").' (database)'; // Timezone server base $sql="SHOW VARIABLES where variable_name = 'system_time_zone'"; $resql = $db->query($sql); if ($resql) @@ -209,7 +211,7 @@ if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') // Client $var=!$var; $tz=(int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']; -print '
'.$langs->trans("ClientTZ").''.($tz?($tz>=0?'+':'').$tz:'').' ('.($tz>=0?'+':'').($tz*60*60).')'; +print '
'.$langs->trans("ClientTZ").''.($tz?($tz>=0?'+':'').$tz:'').' ('.($tz>=0?'+':'').($tz*60*60).')'; print '       '.$_SESSION['dol_tz_string']; print '       '.$langs->trans("DaylingSavingTime").': '; if ($_SESSION['dol_dst']>0) print yn(1); @@ -218,18 +220,18 @@ if (! empty($_SESSION['dol_dst_first'])) print '     ('.dol_print_date print '
  => '.$langs->trans("ClientHour").''.dol_print_date(dol_now(),'dayhour','tzuser').'
  => '.$langs->trans("ClientHour").''.dol_print_date(dol_now(),'dayhour','tzuser').'
'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)'.$filesystemencoding.'
'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)'.$filesystemencoding.'
  => '.$langs->trans("File encoding").''.$tmp.'
  => '.$langs->trans("File encoding").''.$tmp.'
'; print '
'; @@ -291,7 +293,7 @@ $configfileparameters=array( $var=true; print ''; print ''; -print ''; print ''; @@ -357,9 +359,9 @@ print '
'; // Parameters in database print '
'.$langs->trans("Parameters").' '; +print ''.$langs->trans("Parameters").' '; print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')'; print ''.$langs->trans("Parameter").'
'; print ''; -print ''; +print ''; print ''; -if (empty($conf->multicompany->enabled) || !$user->entity) print ''; // If superadmin or multicompany disabled +if (empty($conf->multicompany->enabled) || !$user->entity) print ''; // If superadmin or multicompany disabled print "\n"; $sql = "SELECT"; @@ -394,9 +396,9 @@ if ($resql) $var=!$var; print ''; - print ''."\n"; - print ''."\n"; - if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled + print ''."\n"; + print ''."\n"; + if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled print "\n"; $i++; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index d38270b8827..c917925e87e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -795,7 +795,7 @@ if ($action == 'create') } print ''; } - if(!empty($origin) && !empty($originid)) + if (!empty($origin) && !empty($originid)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 419b32cdea4..f8d2913028c 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1113,15 +1113,26 @@ class ActionComm extends CommonObject if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + $label = $this->label; + if (empty($label)) $label=$this->libelle; // For backward compatibility + $result=''; + // Set label of typ + $labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label; + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) + { + if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL'); + } + + $tooltip = '' . $langs->trans('ShowAction'.$objp->code) . ''; if (! empty($this->ref)) $tooltip .= '
' . $langs->trans('Ref') . ': ' . $this->ref; - $label = $this->label; - if (empty($label)) $label=$this->libelle; // For backward compatibility if (! empty($label)) $tooltip .= '
' . $langs->trans('Title') . ': ' . $label; + if (! empty($labeltype)) + $tooltip .= '
' . $langs->trans('Type') . ': ' . $labeltype; if (! empty($this->location)) $tooltip .= '
' . $langs->trans('Location') . ': ' . $this->location; @@ -1129,11 +1140,11 @@ class ActionComm extends CommonObject if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) $linkclose = ' style="background-color:#'.$this->type_color.'"'; - if (empty($notooltip) && $user->rights->propal->lire) + if (empty($notooltip)) { if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label=$langs->trans("ShowSupplierProposal"); + $label=$langs->trans("ShowAction"); $linkclose.=' alt="'.dol_escape_htmltag($tooltip, 1).'"'; } $linkclose.=' title="'.dol_escape_htmltag($tooltip, 1).'"'; @@ -1166,13 +1177,13 @@ class ActionComm extends CommonObject if ($withpicto == 2) { $libelle=$label; - if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->transnoentities("Action".$this->type_code); + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$labeltype; $libelleshort=''; } else { $libelle=(empty($this->libelle)?$label:$this->libelle.(($label && $label != $this->libelle)?' '.$label:'')); - if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle=($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label; + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle=$labeltype; if ($maxlength < 0) $libelleshort=$this->ref; else $libelleshort=dol_trunc($libelle,$maxlength); } diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 237a1043ac6..c03763c13a6 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -105,9 +105,9 @@ class CActionComm * @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter) * @param string $idorcode 'id' or 'code' * @param string $excludetype Type to exclude ('system' or 'systemauto') - * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type + * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual" * @param string $morefilter Add more SQL filter - * @return mixed Array of all event types if OK, <0 if KO + * @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. */ function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0, $morefilter='') { @@ -123,7 +123,7 @@ class CActionComm if ($active != '') $sql.=" AND active=".$active; if (! empty($excludetype)) $sql.=" AND type <> '".$excludetype."'"; if ($morefilter) $sql.=" AND ".$morefilter; - $sql.= " ORDER BY module, position"; + $sql.= " ORDER BY module, position, type"; dol_syslog(get_class($this)."::liste_array", LOG_DEBUG); $resql=$this->db->query($sql); @@ -140,7 +140,7 @@ class CActionComm $qualified=1; // $obj->type can be system, systemauto, module, moduleauto, xxx, xxxauto - if ($qualified && $onlyautoornot && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO) + if ($qualified && $onlyautoornot > 0 && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO) if ($qualified && $obj->module) { @@ -155,12 +155,19 @@ class CActionComm if ($qualified) { $code=$obj->code; - if ($onlyautoornot && $code == 'AC_OTH') $code='AC_MANUAL'; - if ($onlyautoornot && $code == 'AC_OTH_AUTO') $code='AC_AUTO'; + if ($onlyautoornot > 0 && $code == 'AC_OTH') $code='AC_MANUAL'; + if ($onlyautoornot > 0 && $code == 'AC_OTH_AUTO') $code='AC_AUTO'; $transcode=$langs->trans("Action".$code); - $repid[$obj->id] = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label)); - $repcode[$obj->code] = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label)); - if ($onlyautoornot && preg_match('/^module/',$obj->type) && $obj->module) $repcode[$obj->code].=' ('.$langs->trans("Module").': '.$obj->module.')'; + $label = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label)); + if ($onlyautoornot == -1 && ! empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! preg_match('/auto/i', $code)) + { + $label='  '.$label; + $repid[-99]=$langs->trans("ActionAC_MANUAL"); + $repcode['AC_NON_AUTO']=$langs->trans("ActionAC_MANUAL"); + } + $repid[$obj->id] = $label; + $repcode[$obj->code] = $label; + if ($onlyautoornot > 0 && preg_match('/^module/',$obj->type) && $obj->module) $repcode[$obj->code].=' ('.$langs->trans("Module").': '.$obj->module.')'; } $i++; } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f70b8d171a1..f63bbd7ab79 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -450,7 +450,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; -if ($actioncode) $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')"; +// Condition on actioncode +if (! empty($actioncode)) +{ + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) + { + if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; + else + { + if ($actioncode == 'AC_OTH') $sql.= " AND ca.type != 'systemauto'"; + if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND ca.type = 'systemauto'"; + } + } + else + { + if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; + else + { + $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')"; + } + } +} if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid); if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; @@ -970,7 +992,15 @@ if (empty($action) || $action == 'show_month') // View by month $i=0; while ($i < 7) { - echo ' \n"; + print ' \n"; $i++; } echo " \n"; diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index ec4fba12980..d583d56074e 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -194,7 +194,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= " WHERE c.id = a.fk_action"; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; -if ($actioncode) $sql.=" AND c.code IN ('".$db->escape($actioncode)."')"; +// Condition on actioncode +if (! empty($actioncode)) +{ + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) + { + if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'"; + else + { + if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'"; + if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'"; + } + } + else + { + if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'"; + else + { + $sql.=" AND c.code IN ('".implode("','", explode(',',$actioncode))."')"; + } + } +} if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid); if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; @@ -402,6 +424,7 @@ if ($resql) { if ($actionstatic->type_picto) print img_picto('', $actionstatic->type_picto); else { + if ($actionstatic->type_code == 'AC_RDV') print img_picto('', 'object_group').' '; if ($actionstatic->type_code == 'AC_TEL') print img_picto('', 'object_phoning').' '; if ($actionstatic->type_code == 'AC_FAX') print img_picto('', 'object_phoning_fax').' '; if ($actionstatic->type_code == 'AC_EMAIL') print img_picto('', 'object_email').' '; diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index ae11f06cedd..2dd5d78d9b9 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -365,7 +365,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; -if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; +// Condition on actioncode +if (! empty($actioncode)) +{ + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) + { + if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; + else + { + if ($actioncode == 'AC_OTH') $sql.= " AND ca.type != 'systemauto'"; + if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND ca.type = 'systemauto'"; + } + } + else + { + if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; + else + { + $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')"; + } + } +} if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid); if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index cd5f7d10fa7..5651bca338b 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -96,7 +96,6 @@ else $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); - $dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear')); if ($dateselect > 0) { @@ -373,7 +372,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; -if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; +// Condition on actioncode +if (! empty($actioncode)) +{ + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) + { + if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; + else + { + if ($actioncode == 'AC_OTH') $sql.= " AND ca.type != 'systemauto'"; + if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND ca.type = 'systemauto'"; + } + } + else + { + if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; + else + { + $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')"; + } + } +} if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid); if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; 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/comm/propal/card.php b/htdocs/comm/propal/card.php index 6b47d5205b6..1fe8f76efaa 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; } } } @@ -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/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 ''; // Year print ' > - - - - - - - - + + + + + + + + + 1) +{ + ?> + + + + + + + + + + diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 313fef16e2c..9495895beda 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 @@ -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/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/commande/list.php b/htdocs/commande/list.php index 455db14e3ed..87a95062323 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'); @@ -1012,11 +1014,11 @@ if ($resql) { 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 '
'; // Year print ' > - - - - - - - - + + + + + + + + + 1) +{ + ?> + + + + + + + + + + \ No newline at end of file diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index bb56c494854..20a5a2e8b85 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)) { @@ -527,6 +526,9 @@ if ($page >= $nbtotalofpages) if ($page < 0) $page = 0; } +// If not account defined $mode_balance_ok=false +if (empty($account)) $mode_balance_ok=false; +// If a search is done $mode_balance_ok=false if (! empty($search_ref)) $mode_balance_ok=false; if (! empty($req_nb)) $mode_balance_ok=false; if (! empty($type)) $mode_balance_ok=false; @@ -879,6 +881,12 @@ if ($resql) // If we are in a situation where we need/can show balance, we calculate the start of balance if (! $balancecalculated && ! empty($arrayfields['balance']['checked']) && $mode_balance_ok) { + if (! $account) + { + dol_print_error('', 'account is not defined but $mode_balance_ok is true'); + exit; + } + //Loop on each record $sign = 1; $i = 0; 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..56735d15fce 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=''; } @@ -124,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) @@ -139,9 +147,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 +212,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 +279,8 @@ print '
'.$langs->trans("Parameters").' '.$langs->trans("Database").''.$langs->trans("Parameters").' '.$langs->trans("Database").''.$langs->trans("Value").''.$langs->trans("Entity").''.$langs->trans("Entity").'
'.$obj->name.''.$obj->value.''.$obj->entity.''.$obj->name.''.$obj->value.''.$obj->entity.'
'.$langs->trans("LinkedObject").''.$langs->trans("Day".(($i+(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)) % 7))."'; + $numdayinweek=(($i+(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)) % 7); + if (! empty($conf->dol_optimize_smallscreen)) + { + $labelshort=array(0=>'SundayMin',1=>'MondayMin',2=>'TuesdayMin',3=>'WednesdayMin',4=>'ThursdayMin',5=>'FridayMin',6=>'SaturdayMin'); + print $langs->trans($labelshort[$numdayinweek]); + } + else print $langs->trans("Day".$numdayinweek); + print "
'; - print ''; + print ''; print ''; - print ''; + print ''; 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 '
'.$langs->trans("Year").''; 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")); ?>
trans("Total"); ?>
'; $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 '
'.$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 '
'.$langs->trans("Year").''; if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; 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")); ?> + +
trans("Total"); ?>
'; 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 +313,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 +416,10 @@ foreach ($accounts as $key=>$type) print ''; print ''; + print ''; print ''; - print ''; print ''; print ''; - print ''; + // Status + print ''; + // print ''; @@ -442,7 +457,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/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; } } } 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/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; } } } 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/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 '
'; + // Status + print ''; // Year print ' > - - - - - - - - + + + + + + + + + 1) +{ + ?> + + + + + + + + + + \ No newline at end of file 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 '
'.$acc->getNomUrl(1).''.$acc->label.''; print $acc->type_lib[$acc->type]; print ''.$acc->bank.''.$acc->number.''; if ($acc->rappro) @@ -421,7 +434,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").'
'.$langs->trans("CreatedBy").''; print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); 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 '
'.$langs->trans("Year").''; if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; 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")); ?>
trans("Total"); ?>
'; 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..6a4f7f836e7 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'])) { @@ -75,6 +76,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_ref=""; $search_label=""; $search_amount=""; + $search_status=''; $typeid=""; $year=""; $month=""; @@ -88,7 +90,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 +101,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 != '' && $search_status >= 0) $sql.=" AND cs.paye = ".$db->escape($search_status); if ($year > 0) { $sql .= " AND ("; @@ -118,7 +120,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 +206,10 @@ if ($resql) print ''; print ''; // Status - print ''; + print ''; print '\n"; + $i++; } -print '
'; +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/conf/conf.php.example b/htdocs/conf/conf.php.example index aab5290a663..83dbd300f60 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -134,7 +134,7 @@ $dolibarr_main_db_type=''; // dolibarr_main_db_character_set -// Database character set used to store data (forced during database creation). +// Database character set used to store data (forced during database creation. value of database is then used). // Default value: depends on database driver // Examples: // dolibarr_main_db_character_set='utf8'; @@ -143,12 +143,12 @@ $dolibarr_main_db_character_set='utf8'; // dolibarr_main_db_collation -// Database character set used to sort data (forced during database creation). +// Database character set used to sort data (forced during database creation. value of database is then used). // Default value: depends on database driver // Examples: -// dolibarr_main_db_collation='utf8_general_ci'; +// dolibarr_main_db_collation='utf8_unicode_ci'; // -$dolibarr_main_db_collation='utf8_general_ci'; +$dolibarr_main_db_collation='utf8_unicode_ci'; 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/class/contact.class.php b/htdocs/contact/class/contact.class.php index 4e045ccd449..cd45378ba86 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -123,15 +123,16 @@ class Contact extends CommonObject $sql = "SELECT count(sp.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (sp.fk_soc = s.rowid)"; if (!$user->rights->societe->client->voir && !$user->societe_id) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; + $sql.= " OUTER JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid"; + $sql.= " OUTER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; $clause = "AND"; } - $sql.= ' '.$clause.' s.entity IN ('.getEntity($this->element, 1).')'; - + $sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element, 1).')'; + if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id; + $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index b8c96884e96..7b2e5528eb6 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) && $sall) +{ + $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 "
"; + +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/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; } } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index cdd8b89a1ad..e3e899eceba 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3280,7 +3280,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, $outputalsopricetotalwithtax; // Define usemargins $usemargins=0; @@ -3343,6 +3343,8 @@ abstract class CommonObject // Multicurrency if (!empty($conf->multicurrency->enabled)) print '
'.$langs->trans('TotalHTShortCurrency').''.$langs->trans('TotalTTCShort').'
'.$langs->trans("None").'
'; - return $num; + return $nbofdifferenttypes; } } @@ -5555,8 +5566,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.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 503c1fbb739..16b63c16601 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -180,7 +180,10 @@ class FormActions elseif ($typeelement == 'fichinter') $title=$langs->trans('ActionsOnFicheInter'); else $title=$langs->trans("Actions"); - print load_fiche_titre($title,'',''); + $buttontoaddnewevent = ''; + $buttontoaddnewevent.= $langs->trans("AddEvent"); + $buttontoaddnewevent.= ''; + print load_fiche_titre($title, $buttontoaddnewevent, ''); $page=0; $param=''; $sortfield='a.datep'; @@ -250,13 +253,13 @@ class FormActions * @param array|string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx'). Can be an array too. * @param string $htmlname Name of select field * @param string $excludetype A type to exclude ('systemauto', 'system', '') - * @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type + * @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual" * @param int $hideinfohelp 1=Do not show info help, 0=Show, -1=Show+Add info to tell how to set default value * @param int $multiselect 1=Allow multiselect of action type * @param int $nooutput 1=No output * @return string */ - function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0, $hideinfohelp=0, $multiselect=0, $nooutput=0) + function select_type_actions($selected='', $htmlname='actioncode', $excludetype='', $onlyautoornot=0, $hideinfohelp=0, $multiselect=0, $nooutput=0) { global $langs,$user,$form,$conf; 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/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 109d2c5d23d..a05d8b27c5e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -776,6 +776,8 @@ class FormFile /** * Show a Document icon with link(s) + * You may want to call this into a div like this: + * print '
'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'
'; * * @param string $modulepart propal, facture, facture_fourn, ... * @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. 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/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index b8038056484..c63227e1601 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -36,7 +36,7 @@ abstract class DoliDB implements Database /** @var string Charset used to force charset when creating database */ public $forcecharset='utf8'; /** @var string Collate used to force collate when creating database */ - public $forcecollate='utf8_general_ci'; + public $forcecollate='utf8_unicode_ci'; /** @var resource Resultset of last query */ private $_results; /** @var bool true if connected, else false */ diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 087abf709d9..d7ff764ce7a 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -854,7 +854,7 @@ class DoliDBMysqli extends DoliDB } /** - * Return charset used to store data in database + * Return charset used to store data in current database (same result than using SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "databasename";) * * @return string Charset */ @@ -897,7 +897,7 @@ class DoliDBMysqli extends DoliDB } /** - * Return collation used in database + * Return collation used in current database * * @return string Collation value */ diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index cdc45de825e..57a4c03c63f 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -108,7 +108,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh { $multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE)); } - print $formactions->select_type_actions($actioncode, "actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), 0, $multiselect); + print $formactions->select_type_actions($actioncode, "actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect); print '
- + - +
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)


diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 40ef1e6c896..6acae492c33 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,8 +443,8 @@ if (! $resql) } $num = $db->num_rows($resql); -$i = 0; -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; @@ -848,7 +852,7 @@ print ''; print "\n"; $var=True; - +$i = 0; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 1d8e9348f72..f6149690b7e 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -62,6 +62,10 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $hookmanager->initHooks(array('thirdpartybancard','globalcard')); +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('thirdpartybancard')); + + /* * Actions 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 ''.fieldLabel('FirstName','firstname').''; - print ''; + print ''; print ''; - print ''.fieldLabel('UserTitle','civility_id').''; - print $formcompany->select_civility($object->civility_id).''; + // Title + print ''.fieldLabel('UserTitle','civility_id').''; + print $formcompany->select_civility($object->civility_id, 'civility_id', 'maxwidth100').''; print ''; } @@ -1070,9 +1071,9 @@ else // Zip / Town print ''.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 ''; // Country @@ -1092,15 +1093,15 @@ else // Email web print ''.fieldLabel('EMail','email').(! empty($conf->global->SOCIETE_MAIL_REQUIRED)?'*':'').''; - print ''; + print ''; print ''.fieldLabel('Web','url').''; - print ''; - + print ''; + // Skype if (! empty($conf->skype->enabled)) { print ''.fieldLabel('Skype','skype').''; - print ''; + print ''; } // Phone / Fax diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 0658416797e..3ab1c159545 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); } @@ -1478,41 +1476,6 @@ if ($action == 'create') } print ''; - // Project - /* - if (! empty($conf->projet->enabled)) { - $langs->load("projects"); - 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 ''; - } else { - 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)) { @@ -1596,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 @@ -1625,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 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 ''; 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/support/inc.php b/htdocs/support/inc.php index 2db312ee630..869dace222d 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -184,7 +184,7 @@ function conf($dolibarr_main_document_root) $conf->db->user = trim($dolibarr_main_db_user); $conf->db->pass = trim($dolibarr_main_db_pass); - if (empty($conf->db->dolibarr_main_db_collation)) $conf->db->dolibarr_main_db_collation='utf8_general_ci'; + if (empty($conf->db->dolibarr_main_db_collation)) $conf->db->dolibarr_main_db_collation='utf8_unicode_ci'; return 1; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ae45643c9cb..f1368099864 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; } @@ -546,6 +548,7 @@ div.myavailability { .strikefordisabled { text-decoration: line-through; } +/* using a tdoverflowxxx make the min-with not working */ .tdoverflow { max-width: 0; overflow: hidden; @@ -618,6 +621,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 +634,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 +647,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 +659,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; } @@ -675,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; } @@ -2449,7 +2490,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 +2526,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 +2538,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 +2585,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; @@ -2818,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 { @@ -4623,30 +4664,6 @@ img.demothumb { div.mainmenu { min-width: 20px; } - - #tooltip { - position: absolute; - width: px; - } - select { - width: 100%; - max-width: 100px; - min-width: 50px; - } - 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; - } - } ; 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 { 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(); diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index e10d089c2a8..d60218fba22 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -82,7 +82,7 @@ if ($key != $conf->global->CRON_KEY) // If param userlogin is reserved word 'firstadmin' if ($userlogin == 'firstadmin') { - $sql='SELECT login from '.MAIN_DB_PREFIX.'user WHERE admin = 1 ORDER BY entity LIMIT 1'; + $sql='SELECT login from '.MAIN_DB_PREFIX.'user WHERE admin = 1 and statut = 1 ORDER BY entity LIMIT 1'; $resql=$db->query($sql); if ($resql) {