diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php
index 43ccef1e954..adb590ffcd2 100644
--- a/htdocs/admin/security.php
+++ b/htdocs/admin/security.php
@@ -165,6 +165,16 @@ else if ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK')
exit;
}
+if ($action == 'maj_pattern')
+{
+ dolibarr_set_const($db, "USER_PASSWORD_PATTERN", GETPOST("pattern"),'chaine',0,'',$conf->entity);
+ header("Location: security.php");
+ exit;
+}
+
+
+
+
@@ -265,6 +275,113 @@ foreach ($arrayhandler as $key => $module)
print '';
print '';
+//if($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK == 1)
+// Patter for Password Perso
+if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){
+$var=!$var;
+
+ $tabConf = explode(";",$conf->global->USER_PASSWORD_PATTERN);
+ /*$this->length2 = $tabConf[0];
+ $this->NbMaj = $tabConf[1];
+ $this->NbNum = $tabConf[2];
+ $this->NbSpe = $tabConf[3];
+ $this->NbRepeat = $tabConf[4];
+ $this->WithoutAmbi = $tabConf[5];
+ */
+ print '
';
+
+ print '';
+}
+
+
// Cryptage mot de passe
print '
';
$var=true;
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index fcdda5eaaa1..3eeef6916eb 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -553,146 +553,19 @@ else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST(
}
}
-// Add file in email form
-if (GETPOST('addfile')) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory TODO Use a dedicated directory for temp mails files
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- dol_add_file_process($upload_dir_tmp, 0, 0);
- $action = 'presend';
-}
-
-// Remove file in email form
-if (GETPOST('removedfile')) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- // TODO Delete only files that was uploaded from email form
- dol_remove_file_process($_POST['removedfile'], 0);
- $action = 'presend';
-}
/*
* Send mail
*/
-if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
- $langs->load('mails');
- if ($object->id > 0) {
- if ($_POST['sendto']) {
- // Le destinataire a ete fourni via le champ libre
- $sendto = $_POST['sendto'];
- $sendtoid = 0;
- } elseif ($_POST['receiver'] != '-1') {
- // Recipient was provided from combo list
- if ($_POST['receiver'] == 'thirdparty') // Id of third party
- {
- $sendto = $object->thirdparty->email;
- $sendtoid = 0;
- } else // Id du contact
- {
- $sendto = $object->thirdparty->contact_get_property($_POST['receiver'], 'email');
- $sendtoid = $_POST['receiver'];
- }
- }
+// Actions to send emails
+$actiontypecode='AC_PROP';
+$trigger_name='PROPAL_SENTBYMAIL';
+$paramname='id';
+$mode='emailfromproposal';
+include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
- if (dol_strlen($sendto)) {
- $langs->load("commercial");
- $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>';
- $replyto = $_POST['replytoname'] . ' <' . $_POST['replytomail'] . '>';
- $message = $_POST['message'];
- $sendtocc = $_POST['sendtocc'];
- $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO);
- $deliveryreceipt = $_POST['deliveryreceipt'];
-
- if (dol_strlen($_POST['subject']))
- $subject = $_POST['subject'];
- else
- $subject = $langs->transnoentities('Propal') . ' ' . $object->ref;
- $actiontypecode = 'AC_PROP';
- $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
- if ($message) {
- if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
- $actionmsg = dol_concatdesc($actionmsg, $message);
- }
- $actionmsg2 = $langs->transnoentities('Action' . $actiontypecode);
-
- // Create form object
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
- $formmail = new FormMail($db);
-
- $attachedfiles = $formmail->get_attached_files();
- $filepath = $attachedfiles ['paths'];
- $filename = $attachedfiles ['names'];
- $mimetype = $attachedfiles ['mimes'];
-
- // Envoi de la propal
- require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
- $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, - 1);
- if ($mailfile->error) {
- setEventMessage($mailfile->error, 'errors');
- } else {
- $result = $mailfile->sendfile();
- if ($result) {
- // Initialisation donnees
- $object->sendtoid = $sendtoid;
- $object->actiontypecode = $actiontypecode;
- $object->actionmsg = $actionmsg;
- $object->actionmsg2 = $actionmsg2;
- $object->fk_element = $object->id;
- $object->elementtype = $object->element;
-
- // Appel des triggers
- include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
- $interface = new Interfaces($db);
- $result = $interface->run_triggers('PROPAL_SENTBYMAIL', $object, $user, $langs, $conf);
- if ($result < 0) {
- $error++;
- $object->errors = $interface->errors;
- }
- // Fin appel triggers
-
- if (! $error) {
- // Redirect here
- // This avoid sending mail twice if going out and then back to page
- $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
- setEventMessage($mesg);
- header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
- exit();
- } else {
- dol_print_error($db);
- }
- } else {
- $langs->load("other");
- if ($mailfile->error) {
- $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
- $mesg .= '
' . $mailfile->error;
- } else {
- $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
- }
- setEventMessage($mesg, 'errors');
- }
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorMailRecipientIsEmpty') . '!', 'errors');
- dol_syslog($langs->trans('ErrorMailRecipientIsEmpty'));
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")), 'errors');
- dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")));
- }
-}
// Go back to draft
if ($action == 'modif' && $user->rights->propal->creer)
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 6522a592097..2b8e478d37d 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -322,8 +322,11 @@ if ($result)
print '';
$formpropal->selectProposalStatus($viewstatut,1);
print ' | ';
- print '';
- print ' | ';
+ print '';
+ print '';
+ print ' ';
+ print '';
+ print ' | ';
print "\n";
$var=true;
diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php
index 94286ee4c53..113618ffae8 100644
--- a/htdocs/comm/prospect/list.php
+++ b/htdocs/comm/prospect/list.php
@@ -48,7 +48,6 @@ $search_state = GETPOST("search_state");
$search_datec = GETPOST("search_datec");
$search_categ = GETPOST("search_categ",'int');
$search_status = GETPOST("search_status",'int');
-if ($search_status=='') $search_status=1; // always display activ customer first
$catid = GETPOST("catid",'int');
$sortfield = GETPOST("sortfield",'alpha');
@@ -154,6 +153,21 @@ $sts = array(-1,0,1,2,3);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('prospectlist'));
+// Do we click on purge search criteria ?
+if (GETPOST("button_removefilter_x"))
+{
+ $socname="";
+ $stcomm="";
+ $search_nom="";
+ $search_zipcode="";
+ $search_town="";
+ $search_state="";
+ $search_datec="";
+ $search_categ="";
+ $search_status="";
+}
+
+if ($search_status=='') $search_status=1; // always display active customer first
/*
* Actions
@@ -361,7 +375,7 @@ if ($resql)
// Print these two select
print $langs->trans("From").' ';
print ' ';
- print $langs->trans("To").' ';
+ print $langs->trans("to").' ';
print '';
@@ -378,9 +392,9 @@ if ($resql)
print '';
// Print the search button
- print '';
- print '';
- print ' | ';
+ print '';
+ print '';
+ print " | \n";
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 792da64a923..4bf1eceb6dc 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1151,162 +1151,18 @@ else if ($action == 'update_extras') {
$action = 'edit_extras';
}
-/*
- * Add file in email form
- */
-if (GETPOST('addfile')) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory TODO Use a dedicated directory for temp mails files
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- dol_add_file_process($upload_dir_tmp, 0, 0);
- $action = 'presend';
-}
-
-/*
- * Remove file in email form
- */
-if (GETPOST('removedfile')) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- // TODO Delete only files that was uploaded from email form
- dol_remove_file_process(GETPOST('removedfile'), 0);
- $action = 'presend';
-}
-
/*
* Send mail
*/
-if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
- $langs->load('mails');
- if ($object->id > 0) {
- // $ref = dol_sanitizeFileName($object->ref);
- // $file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
+// Actions to send emails
+$actiontypecode='AC_COM';
+$trigger_name='ORDER_SENTBYMAIL';
+$paramname='id';
+$mode='emailfromorder';
+include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
- // if (is_readable($file))
- // {
- if (GETPOST('sendto')) {
- // Le destinataire a ete fourni via le champ libre
- $sendto = GETPOST('sendto');
- $sendtoid = 0;
- } elseif (GETPOST('receiver') != '-1') {
- // Recipient was provided from combo list
- if (GETPOST('receiver') == 'thirdparty') // Id of third party
- {
- $sendto = $object->thirdparty->email;
- $sendtoid = 0;
- } else // Id du contact
- {
- $sendto = $object->thirdparty->contact_get_property(GETPOST('receiver'), 'email');
- $sendtoid = GETPOST('receiver');
- }
- }
- if (dol_strlen($sendto)) {
- $langs->load("commercial");
-
- $from = GETPOST('fromname') . ' <' . GETPOST('frommail') . '>';
- $replyto = GETPOST('replytoname') . ' <' . GETPOST('replytomail') . '>';
- $message = GETPOST('message');
- $sendtocc = GETPOST('sendtocc');
- $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO);
- $deliveryreceipt = GETPOST('deliveryreceipt');
-
- if ($action == 'send') {
- if (dol_strlen(GETPOST('subject')))
- $subject = GETPOST('subject');
- else
- $subject = $langs->transnoentities('Order') . ' ' . $object->ref;
- $actiontypecode = 'AC_COM';
- $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
- if ($message) {
- if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
- $actionmsg = dol_concatdesc($actionmsg, $message);
- }
- $actionmsg2 = $langs->transnoentities('Action' . $actiontypecode);
- }
-
- // Create form object
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
- $formmail = new FormMail($db);
-
- $attachedfiles = $formmail->get_attached_files();
- $filepath = $attachedfiles ['paths'];
- $filename = $attachedfiles ['names'];
- $mimetype = $attachedfiles ['mimes'];
-
- // Send mail
- require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
- $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, - 1);
- if ($mailfile->error) {
- setEventMessage($mailfile->error, 'errors');
- } else {
- $result = $mailfile->sendfile();
- if ($result) {
- //Must not contain quotes
- $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
- setEventMessage($mesg);
-
- $error = 0;
-
- // Initialisation donnees
- $object->sendtoid = $sendtoid;
- $object->actiontypecode = $actiontypecode;
- $object->actionmsg = $actionmsg;
- $object->actionmsg2 = $actionmsg2;
- $object->fk_element = $object->id;
- $object->elementtype = $object->element;
-
- // Appel des triggers
- include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
- $interface = new Interfaces($db);
- $result = $interface->run_triggers('ORDER_SENTBYMAIL', $object, $user, $langs, $conf);
- if ($result < 0) {
- $error ++;
- $this->errors = $interface->errors;
- }
- // Fin appel triggers
-
- if ($error) {
- dol_print_error($db);
- } else {
- // Redirect here
- // This avoid sending mail twice if going out and then back to page
- header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
- exit();
- }
- } else {
- $langs->load("other");
- if ($mailfile->error) {
- $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
- $mesg .= '
' . $mailfile->error;
- } else {
- $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
- }
-
- setEventMessage($mesg, 'errors');
- }
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorMailRecipientIsEmpty') . '!', 'errors');
- dol_syslog($langs->trans('ErrorMailRecipientIsEmpty'));
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")), 'errors');
- dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")));
- }
-}
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) {
if ($action == 'addcontact') {
diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php
index 25b7d91a3ff..1e8196481e6 100644
--- a/htdocs/compta/bank/search.php
+++ b/htdocs/compta/bank/search.php
@@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
$langs->load("banks");
$langs->load("categories");
$langs->load("companies");
+$langs->load("margins");
// Security check
if ($user->societe_id) $socid=$user->societe_id;
@@ -72,6 +73,15 @@ $limit = $conf->liste_limit;
if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='b.dateo';
+if (GETPOST("button_removefilter"))
+{
+ $description="";
+ $type="";
+ $debit="";
+ $credit="";
+ $account="";
+ $bid="";
+}
/*
* View
@@ -198,7 +208,7 @@ if ($resql)
print ' | ';
print ' | ';
print '';
- $form->select_types_paiements(empty($_REQUEST["type"])?'':$_REQUEST["type"], 'type', '', 2, 0, 1, 8);
+ $form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 8);
print ' | ';
print ' | ';
print '';
@@ -214,9 +224,9 @@ if ($resql)
print ' | ';
print '';
if (! empty($_REQUEST['bid'])) print '';
- print '';
- print ' | ';
- print '';
+ print '';
+ print '';
+ print "\n";
// Loop on each record
$total_debit=0;
diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php
index bb2c50b42bf..da0e3e21dcd 100644
--- a/htdocs/compta/deplacement/list.php
+++ b/htdocs/compta/deplacement/list.php
@@ -27,6 +27,8 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("companies");
$langs->load("users");
@@ -37,6 +39,10 @@ $socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'deplacement','','');
+$search_ref=GETPOST('search_ref','int');
+$search_name=GETPOST('search_name','alpha');
+$search_company=GETPOST('search_company','alpha');
+// $search_amount=GETPOST('search_amount','alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
@@ -48,13 +54,24 @@ if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="d.dated";
$limit = $conf->liste_limit;
-$search_ref=GETPOST('search_ref','alpha');
+$year=GETPOST("year");
+$month=GETPOST("month");
+if (GETPOST("button_removefilter"))
+{
+ $search_ref="";
+ $search_name="";
+ $search_company="";
+ // $search_amount="";
+ $year="";
+ $month="";
+}
/*
* View
*/
+$formother = new FormOther($db);
$tripandexpense_static=new Deplacement($db);
$userstatic = new User($db);
@@ -76,10 +93,31 @@ $sql.= " AND d.entity = ".$conf->entity;
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
-if (trim($search_ref) != '')
+
+if ($search_ref) $sql.=" AND d.rowid=".$search_ref;
+if ($search_name)
{
- $sql.= ' AND d.rowid LIKE \'%'.$db->escape(trim($search_ref)) . '%\'';
+ $sql .= natural_search('u.lastname', $search_name);
}
+if ($search_company)
+{
+ $sql .= natural_search('s.nom', $search_company);
+}
+// if ($search_amount) $sql.=" AND d.km='".$db->escape(price2num(trim($search_amount)))."'";
+if ($month > 0)
+{
+ if ($year > 0 && empty($day))
+ $sql.= " AND d.dated BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
+ else if ($year > 0 && ! empty($day))
+ $sql.= " AND d.dated BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
+ else
+ $sql.= " AND date_format(d.dated, '%m') = '".$month."'";
+}
+else if ($year > 0)
+{
+ $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
+}
+
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset);
@@ -97,7 +135,7 @@ if ($resql)
print "";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"d.type","","&socid=$socid",'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.lastname","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("FeesKilometersOrAmout"),$_SERVER["PHP_SELF"],"d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder);
@@ -107,24 +145,27 @@ if ($resql)
// Filters lines
print '
';
print '| ';
- print '';
+ print '';
print ' | ';
print '';
- //print '';
+ print ' ';
+ print ' | ';
+ print '';
+ if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '';
+ print '';
+ $formother->select_year($year?$year:-1,'year',1, 20, 5);
print ' | ';
print '';
- //print '';
+ print '';
print ' | ';
- print '';
- print ' ';
+ print ' | ';
+ print '';
print ' | ';
print '';
- print ' ';
- print ' | ';
- print '';
- print ' ';
+ // print '';
print ' | ';
print '';
+ print '';
print " |
\n";
$var=true;
@@ -142,9 +183,9 @@ if ($resql)
// Type
print ''.$langs->trans($obj->type).' | ';
// Date
- print ''.dol_print_date($db->jdate($obj->dd),'day').' | ';
+ print ''.dol_print_date($db->jdate($obj->dd),'day').' | ';
// User
- print '';
+ print ' | ';
$userstatic->id = $obj->rowid;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
diff --git a/htdocs/compta/dons/list.php b/htdocs/compta/dons/list.php
index badc71c96e2..174b5357bb2 100644
--- a/htdocs/compta/dons/list.php
+++ b/htdocs/compta/dons/list.php
@@ -43,12 +43,20 @@ if (! $sortfield) $sortfield="d.datedon";
$limit = $conf->liste_limit;
$statut=isset($_GET["statut"])?$_GET["statut"]:"-1";
-$search_ref=GETPOST('search_ref');
-$search_company=GETPOST('search_company');
-$search_name=GETPOST('search_name');
+$search_ref=GETPOST('search_ref','alpha');
+$search_company=GETPOST('search_company','alpha');
+$search_name=GETPOST('search_name','alpha');
+$search_amount = GETPOST('search_amount','alpha');
if (!$user->rights->don->lire) accessforbidden();
+if (GETPOST("button_removefilter"))
+{
+ $search_ref="";
+ $search_company="";
+ $search_name="";
+ $search_amount="";
+}
/*
* View
@@ -82,6 +90,8 @@ if (trim($search_name) != '')
{
$sql .= natural_search(array('d.lastname', 'd.firstname'), $search_name);
}
+if ($search_amount) $sql.=" AND d.amount='".$db->escape(price2num(trim($search_amount)))."'";
+
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);
@@ -141,11 +151,10 @@ if ($resql)
print ' ';
print ' | ';
}
- print '';
- print ' ';
- print ' | ';
+ print ' | ';
print '';
- print " | \n";
+ print '';
+ print "\n";
$var=True;
while ($i < min($num,$limit))
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 2ba425f5a90..9d003ae0aa7 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1550,178 +1550,24 @@ if (GETPOST('linkedOrder')) {
$result = $object->add_object_linked('commande', GETPOST('linkedOrder'));
}
-/*
- * Add file in email form
- */
-if (GETPOST('addfile')) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- dol_add_file_process($upload_dir_tmp, 0, 0);
- $action = 'presend';
-}
-
-/*
- * Remove file in email form
- */
-if (! empty($_POST['removedfile'])) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- // TODO Delete only files that was uploaded from email form
- dol_remove_file_process($_POST['removedfile'], 0);
- $action = 'presend';
-}
/*
* Send mail
*/
-if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) {
- $langs->load('mails');
- $actiontypecode = '';
- $subject = '';
- $actionmsg = '';
- $actionmsg2 = '';
+// Actions to send emails
+if (empty($id)) $id=$facid;
+$actiontypecode='AC_FAC';
+$trigger_name='BILL_SENTBYMAIL';
+$paramname='id';
+$mode='emailfrominvoice';
+include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
- $result = $object->fetch($id);
- $result = $object->fetch_thirdparty();
-
- if ($result > 0) {
- // $ref = dol_sanitizeFileName($object->ref);
- // $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
-
- // if (is_readable($file))
- // {
- if ($_POST['sendto']) {
- // Le destinataire a ete fourni via le champ libre
- $sendto = $_POST['sendto'];
- $sendtoid = 0;
- } elseif ($_POST['receiver'] != '-1') {
- // Recipient was provided from combo list
- if ($_POST['receiver'] == 'thirdparty') // Id of third party
- {
- $sendto = $object->thirdparty->email;
- $sendtoid = 0;
- } else // Id du contact
- {
- $sendto = $object->thirdparty->contact_get_property($_POST['receiver'], 'email');
- $sendtoid = $_POST['receiver'];
- }
- }
-
- if (dol_strlen($sendto))
- {
- $langs->load("commercial");
-
- $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>';
- $replyto = $_POST['replytoname'] . ' <' . $_POST['replytomail'] . '>';
- $message = $_POST['message'];
- $sendtocc = $_POST['sendtocc'];
- $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
- $deliveryreceipt = $_POST['deliveryreceipt'];
-
- if ($action == 'send' || $action == 'relance')
- {
- if (dol_strlen($_POST['subject']))
- $subject = $_POST['subject'];
- else
- $subject = $langs->transnoentities('Bill') . ' ' . $object->ref;
- $actiontypecode = 'AC_FAC';
- $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
- if ($message) {
- if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
- $actionmsg = dol_concatdesc($actionmsg, $message);
- }
- // $actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
- }
-
- // Create form object
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
- $formmail = new FormMail($db);
-
- $attachedfiles = $formmail->get_attached_files();
- $filepath = $attachedfiles['paths'];
- $filename = $attachedfiles['names'];
- $mimetype = $attachedfiles['mimes'];
-
- // Send mail
- require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
- $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, - 1);
- if ($mailfile->error) {
- setEventMessage($mailfile->error, 'errors');
- } else {
- $result = $mailfile->sendfile();
- if ($result) {
- $error = 0;
-
- // Initialisation donnees
- $object->sendtoid = $sendtoid;
- $object->actiontypecode = $actiontypecode;
- $object->actionmsg = $actionmsg; // Long text
- $object->actionmsg2 = $actionmsg2; // Short text
- $object->fk_element = $object->id;
- $object->elementtype = $object->element;
-
- // Appel des triggers
- include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
- $interface = new Interfaces($db);
- $result = $interface->run_triggers('BILL_SENTBYMAIL', $object, $user, $langs, $conf);
- if ($result < 0) {
- $error++;
- $object->errors = $interface->errors;
- }
- // Fin appel triggers
-
- if ($error) {
- dol_print_error($db);
- } else {
- // Redirect here
- // This avoid sending mail twice if going out and then back to page
- $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
- setEventMessage($mesg);
- header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id);
- exit();
- }
- } else {
- $langs->load("other");
-
- if ($mailfile->error) {
- $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
- $mesg .= '
' . $mailfile->error;
- } else {
- $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
- }
-
- setEventMessage($mesg, 'errors');
- }
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorMailRecipientIsEmpty') . '!', 'errors');
- dol_syslog($langs->trans('ErrorMailRecipientIsEmpty'));
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Invoice")), 'errors');
- dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.');
- }
-
- $action = 'presend';
-}
/*
* Generate document
*/
-else if ($action == 'builddoc') // En get ou en post
+if ($action == 'builddoc') // En get ou en post
{
$object->fetch($id);
$object->fetch_thirdparty();
diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php
index 1699656acb1..47a6ee8ba74 100644
--- a/htdocs/compta/paiement/cheque/list.php
+++ b/htdocs/compta/paiement/cheque/list.php
@@ -38,6 +38,9 @@ $langs->load("bills");
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'banque', '','');
+$search_ref = GETPOST('search_ref','int');
+$search_account = GETPOST('search_account','int');
+$search_amount = GETPOST('search_amount','alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
@@ -57,6 +60,16 @@ $formother = new FormOther($db);
$checkdepositstatic=new RemiseCheque($db);
$accountstatic=new Account($db);
+// If click on purge search criteria ?
+if (GETPOST("button_removefilter_x"))
+{
+ $search_ref='';
+ $search_amount='';
+ $search_account='';
+ $year='';
+ $month='';
+}
+
/*
* View
*/
@@ -72,9 +85,9 @@ $sql.= " WHERE bc.fk_bank_account = ba.rowid";
$sql.= " AND bc.entity = ".$conf->entity;
// Search criteria
-if (GETPOST("search_ref")) $sql.=" AND bc.number=".GETPOST("search_ref",'int');
-if (GETPOST("search_account") > 0) $sql.=" AND bc.fk_bank_account=".GETPOST("search_account",'int');
-if (GETPOST("search_amount")) $sql.=" AND bc.amount=".price2num(GETPOST("search_amount"));
+if ($search_ref) $sql.=" AND bc.number=".$search_ref;
+if ($search_account > 0) $sql.=" AND bc.fk_bank_account=".$search_account;
+if ($search_amount) $sql.=" AND bc.amount='".$db->escape(price2num(trim($search_amount)))."'";
if ($month > 0)
{
if ($year > 0 && empty($day))
@@ -103,7 +116,7 @@ if ($resql)
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num);
- print '