diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index c77c4279439..78e73fe0717 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -371,6 +371,7 @@ if ($resql) print ''; print ''; + print ''; print ''; print ''; print ''; @@ -382,7 +383,6 @@ if ($resql) print ''; print ''; if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print ''; - print ''; print ''; print $formactions->form_select_status_action('formaction',$status,1,'status',1,2); print ''; @@ -395,7 +395,8 @@ if ($resql) print ''; print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder); print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); @@ -403,7 +404,6 @@ if ($resql) print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre(""); print "\n"; @@ -437,13 +437,23 @@ if ($resql) print ''; - // Action (type) + // Ref print ''; print $actionstatic->getNomUrl(1,-1); print ''; - // Action (type) - print ''; + // User owner + print ''; + if ($obj->fk_user_action > 0) + { + $userstatic->fetch($obj->fk_user_action); + print $userstatic->getNomUrl(-1); + } + else print ' '; + print ''; + + // Label + print ''; print $actionstatic->label; print ''; @@ -482,7 +492,7 @@ if ($resql) print ''; // Third party - print ''; + print ''; if ($obj->socid) { $societestatic->id=$obj->socid; @@ -520,16 +530,6 @@ if ($resql) print ''; } - // User owner - print ''; - if ($obj->fk_user_action > 0) - { - $userstatic->fetch($obj->fk_user_action); - print $userstatic->getNomUrl(-1); - } - else print ' '; - print ''; - // Status/Percent $datep=$db->jdate($obj->datep); print ''.$actionstatic->LibStatut($obj->percent,3,0,$datep).''; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 932cc211d12..8f86ec8cb60 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -296,7 +296,7 @@ class FormMail extends Form } $arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id); //var_dump($this->param["models"]); - //var_dump($arraydefaultmessage); + //var_dump($model_id); $out.= "\n".'
'."\n"; if ($this->withform == 1) @@ -835,11 +835,11 @@ class FormMail extends Form /** - * Return template of email - * Search into table c_email_templates + * Return templates of email with type = $type_template or type = 'all' + * This search into table c_email_templates. * * @param DoliDB $db Database handler - * @param string $type_template Get message for key module + * @param string $type_template Get message for type=$type_template, type='all' also included. * @param string $user Use template public or limited to this user * @param Translate $outputlangs Output lang object * @param int $id Id template to find @@ -852,9 +852,9 @@ class FormMail extends Form $sql = "SELECT label, topic, content, content_lines, lang"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; - $sql.= " WHERE type_template='".$db->escape($type_template)."'"; + $sql.= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')"; $sql.= " AND entity IN (".getEntity('c_email_templates', 0).")"; - $sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; + $sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned if ($active >= 0) $sql.=" AND active = ".$active; if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; if (!empty($id)) $sql.= " AND rowid=".$id; @@ -873,7 +873,7 @@ class FormMail extends Form $ret['content_lines']=$obj->content_lines; $ret['lang']=$obj->lang; } - else + else // If there is no template at all { $defaultmessage=''; if ($type_template=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index fe36e0e02f4..159e7a6435a 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -618,7 +618,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin $projecttmp = new Project($db); $i=0; - $var=true; + while ($i < $num) { $obj = $db->fetch_object($result); @@ -629,7 +629,6 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin if ($user->rights->projet->lire && $userAccess > 0) { - $var = !$var; print ''; // Ref @@ -665,7 +664,6 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin } else { - $var = false; print ''.$langs->trans("None").''; } $db->free($result); @@ -712,6 +710,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="p.lastname"; + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers + { + $search_status = ''; + $search_name = ''; + $search_addressphone = ''; + $search_array_options=array(); + } + $i=-1; $contactstatic = new Contact($db); @@ -741,29 +747,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; print ''; + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print "\n".''."\n"; $param="socid=".$object->id; if ($search_status != '') $param.='&search_status='.$search_status; if ($search_name != '') $param.='&search_name='.urlencode($search_name); - $colspan=9; - print ''; - print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); - print_liste_field_titre("Poste",$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder); - print_liste_field_titre( $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); - print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder); - // Add to agenda - if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create)) - { - $colspan++; - print_liste_field_titre(''); - } - // Edit - print_liste_field_titre(''); - print "\n"; - - $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.civility, p.poste, p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut, p.photo,"; $sql .= " p.civility as civility_id, p.address, p.zip, p.town"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; @@ -778,43 +769,59 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $num = $db->num_rows($result); - $var=true; + $colspan=9; + + if ($num || (GETPOST('button_search','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search_x','alpha'))) + { + print ''; + + // Photo - Name + print ''; + + // Position + print ''; + + // Address - Phone - Email + print ''; + + // Status + print ''; + + // Add to agenda + if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) + { + $colspan++; + print ''; + } + + // Action + print ''; + + print ""; + } + + print ''; + print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("Poste",$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder); + print_liste_field_titre( $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder); + // Add to agenda + if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create)) print_liste_field_titre(''); + // Edit + print_liste_field_titre(''); + print "\n"; + if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x'))) { - print ''; - - // Photo - Name - print ''; - - // Position - print ''; - - // Address - Phone - Email - print ''; - - // Status - print ''; - - // Add to agenda - if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) - { - $colspan++; - print ''; - } - - // Edit - print ''; - - print ""; - - $i=0; + $i=0; while ($i < $num) { @@ -890,11 +897,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') } else { - print ""; + print ''; print ''; print "\n"; } print "\n
'; + print ''; + print ''; + print ''; + print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status); + print ''; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; + print '
'; - print ''; - print ''; - print ' '; - print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status); - print ' '; - print ''; - print '
'.$langs->trans("None").'
\n"; + print '
'; print ''."\n"; @@ -943,12 +951,8 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='') if ($num > 0) { - $var=true; - foreach ($addressstatic->lines as $address) { - $var = !$var; - print ''; print ''; @@ -1115,7 +1119,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= { $i = 0 ; $num = $db->num_rows($resql); - $var=true; + while ($i < $num) { $obj = $db->fetch_object($resql); @@ -1162,7 +1166,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= } } - // Add also event from emailings. FIXME This should be replaced by an automatic event + // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. if (! empty($conf->mailing->enabled) && ! empty($objcon->email)) { $langs->load("mails"); @@ -1183,7 +1187,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= { $i = 0 ; $num = $db->num_rows($resql); - $var=true; + while ($i < $num) { $obj = $db->fetch_object($resql); @@ -1304,7 +1308,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo - $out.=""; + $out.=''; // Done or todo if ($donetodo) @@ -1446,7 +1450,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= } // Status - $out.=''.$actionstatic->LibStatut($histo[$key]['percent'],3,1,$histo[$key]['datestart']).''; + $out.=''.$actionstatic->LibStatut($histo[$key]['percent'],3,0,$histo[$key]['datestart']).''; // Actions $out.=''; @@ -1503,12 +1507,10 @@ function show_subsidiaries($conf,$langs,$db,$object) print ""; $i=0; - $var=true; while ($i < $num) { $obj = $db->fetch_object($result); - $var = !$var; print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f24cf0338c5..b712e5059b3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3414,13 +3414,13 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m if ($field1 != $sortfield1) // We are on another field { - if (preg_match('/^DESC/', $sortorder)) $out.= ''; - else $out.= ''; + if (preg_match('/^DESC/', $sortorder)) $out.= ''; + else $out.= ''; } else // We are of first sorting criteria { - if (preg_match('/^ASC/', $sortorder)) $out.= ''; - else $out.= ''; + if (preg_match('/^ASC/', $sortorder)) $out.= ''; + else $out.= ''; } }