';
print '';
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..96d633bd834 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -322,7 +322,9 @@ if ($result)
print ' ';
$formpropal->selectProposalStatus($viewstatut,1);
print ' ';
- print ' ';
+ print '';
+ print ' ';
+ print ' ';
print ' ';
print " \n";
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").' '.$options_from.' ';
print ' ';
- print $langs->trans("To").' '.$options_to.' ';
+ print $langs->trans("to").' '.$options_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/commande/list.php b/htdocs/commande/list.php
index 84f8e455d11..ea17d895b95 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -43,9 +43,9 @@ $orderyear=GETPOST("orderyear","int");
$ordermonth=GETPOST("ordermonth","int");
$deliveryyear=GETPOST("deliveryyear","int");
$deliverymonth=GETPOST("deliverymonth","int");
-$sref=GETPOST('sref','alpha');
-$sref_client=GETPOST('sref_client','alpha');
-$snom=GETPOST('snom','alpha');
+$search_ref=GETPOST('search_ref','alpha');
+$search_ref_customer=GETPOST('search_ref_customer','alpha');
+$search_company=GETPOST('search_company','alpha');
$sall=GETPOST('sall');
$socid=GETPOST('socid','int');
$search_user=GETPOST('search_user','int');
@@ -69,6 +69,20 @@ $limit = $conf->liste_limit;
$viewstatut=GETPOST('viewstatut');
+// Purge search criteria
+if (GETPOST("button_removefilter"))
+{
+ $search_categ='';
+ $search_user='';
+ $search_sale='';
+ $search_ref='';
+ $search_ref_customer='';
+ $search_company='';
+ $orderyear='';
+ $ordermonth='';
+ $deliverymonth='';
+ $deliveryyear='';
+}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('orderlist'));
@@ -81,24 +95,6 @@ $parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
-// Do we click on purge search criteria ?
-if (GETPOST("button_removefilter_x"))
-{
- $search_categ='';
- $search_user='';
- $search_sale='';
- $search_ref='';
- $search_refcustomer='';
- $search_societe='';
- $search_montant_ht='';
- $orderyear='';
- $ordermonth='';
- $deliverymonth='';
- $deliveryyear='';
-}
-
-
-
/*
* View
*/
@@ -128,8 +124,8 @@ $sql.= ' WHERE c.fk_soc = s.rowid';
$sql.= ' AND c.entity = '.$conf->entity;
if ($socid) $sql.= ' AND s.rowid = '.$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
-if ($sref) {
- $sql .= natural_search('c.ref', $sref);
+if ($search_ref) {
+ $sql .= natural_search('c.ref', $search_ref);
}
if ($sall)
{
@@ -188,13 +184,13 @@ else if ($deliveryyear > 0)
{
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,12,false))."'";
}
-if (!empty($snom))
+if (!empty($search_company))
{
- $sql .= natural_search('s.nom', $snom);
+ $sql .= natural_search('s.nom', $search_company);
}
-if (!empty($sref_client))
+if (!empty($search_ref_customer))
{
- $sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\'';
+ $sql.= ' AND c.ref_client LIKE \'%'.$db->escape($search_ref_customer).'%\'';
}
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
if ($search_user > 0)
@@ -246,15 +242,15 @@ if ($resql)
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
- if ($ordermonth) $param.='&ordermonth='.$ordermonth;
- if ($orderyear) $param.='&orderyear='.$orderyear;
- if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth;
- if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear;
- if ($sref) $param.='&sref='.$sref;
- if ($snom) $param.='&snom='.$snom;
- if ($sref_client) $param.='&sref_client='.$sref_client;
- if ($search_user > 0) $param.='&search_user='.$search_user;
- if ($search_sale > 0) $param.='&search_sale='.$search_sale;
+ if ($ordermonth) $param.='&ordermonth='.$ordermonth;
+ if ($orderyear) $param.='&orderyear='.$orderyear;
+ if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth;
+ if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear;
+ if ($search_ref) $param.='&search_ref='.$search_ref;
+ if ($search_company) $param.='&search_company='.$search_company;
+ if ($search_ref_customer) $param.='&search_ref_customer='.$search_ref_customer;
+ if ($search_user > 0) $param.='&search_user='.$search_user;
+ if ($search_sale > 0) $param.='&search_sale='.$search_sale;
$num = $db->num_rows($resql);
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
@@ -294,33 +290,35 @@ if ($resql)
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'c.ref','',$param,'width="25%"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('RefCustomerOrder'),$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="right"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="right"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
print '';
+
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
- print '';
+ print ' ';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ' ';
print ' ';
$formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5);
- print ' ';
+ print ' ';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ' ';
print ' ';
$formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5);
- print ' ';
- print ' ';
- print ' ';
- print ' ';
+ print '';
+ print ' ';
+ print ' ';
+ print ' ';
+ print " \n";
$var=true;
$total=0;
@@ -443,12 +441,12 @@ if ($resql)
print '';
// Order date
- print '';
+ print ' ';
print dol_print_date($db->jdate($objp->date_commande), 'day');
print ' ';
// Delivery date
- print '';
+ print ' ';
print dol_print_date($db->jdate($objp->date_livraison), 'day');
print ' ';
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..42a6713c1ce 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 d.dated 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/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index 55ef0a5ef80..1fd4d2c80fc 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$langs->load('bills');
+$langs->load('compta');
// Security check
$id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int'));
diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php
index 27f2cf3e2e7..27782259333 100644
--- a/htdocs/compta/paiement/cheque/index.php
+++ b/htdocs/compta/paiement/cheque/index.php
@@ -90,6 +90,7 @@ else
//print '';
print '';
+$max=10;
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.number as ref";
$sql.= ", bc.statut, bc.nbcheque";
@@ -98,8 +99,8 @@ $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE ba.rowid = bc.fk_bank_account";
$sql.= " AND bc.entity = ".$conf->entity;
-$sql.= " ORDER BY bc.rowid";
-$sql.= " DESC LIMIT 10";
+$sql.= " ORDER BY bc.date_bordereau DESC, rowid DESC";
+$sql.= $db->plimit($max);
$resql = $db->query($sql);
@@ -107,7 +108,7 @@ if ($resql)
{
print '
';
print '';
- print ''.$langs->trans("CheckReceiptShort").' ';
+ print ''.$langs->trans("LastCheckReceiptShort",$max).' ';
print ''.$langs->trans("Date")." ";
print ''.$langs->trans("Account").' ';
print ''.$langs->trans("NbOfCheques").' ';
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 '';
}
@@ -229,13 +230,20 @@ if ($id)
if ($action == '')
{
- if ($bon->statut == 2 && $lipre->statut == 2 && $user->rights->prelevement->bons->credit)
+ if ($bon->statut == 2 && $lipre->statut == 2)
{
- print "id\">".$langs->trans("StandingOrderReject")." ";
+ if ($user->rights->prelevement->bons->credit)
+ {
+ print "id\">".$langs->trans("StandingOrderReject")." ";
+ }
+ else
+ {
+ print "trans("NotAllowed")."\">".$langs->trans("StandingOrderReject")." ";
+ }
}
else
{
- print "".$langs->trans("StandingOrderReject")." ";
+ print "trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject")." ";
}
}
@@ -256,7 +264,7 @@ if ($id)
* Liste des factures
*/
$sql = "SELECT pf.rowid";
- $sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc";
+ $sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc, f.paye, f.fk_statut";
$sql.= " , s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
@@ -287,7 +295,7 @@ if ($id)
print"\n\n";
print '';
print '';
- print ''.$langs->trans("Invoice").' '.$langs->trans("ThirdParty").' '.$langs->trans("Amount").' ';
+ print ''.$langs->trans("Invoice").' '.$langs->trans("ThirdParty").' '.$langs->trans("Amount").' '.$langs->trans("Status").' ';
print ' ';
$var=True;
@@ -312,6 +320,11 @@ if ($id)
print ''.price($obj->total_ttc)." \n";
+ print '';
+ $invoicestatic->fetch($obj->facid);
+ print $invoicestatic->getLibStatut(5);
+ print " \n";
+
print "\n";
$i++;
diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php
index 10fb995c023..0a68aa686ae 100644
--- a/htdocs/compta/prelevement/list.php
+++ b/htdocs/compta/prelevement/list.php
@@ -42,10 +42,10 @@ $result = restrictedArea($user, 'prelevement','','','bons');
$page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.datec" : GETPOST('sortfield','alpha');
-$search_line = GETPOST('search_ligne','alpha');
+$search_line = GETPOST('search_line','alpha');
$search_bon = GETPOST('search_bon','alpha');
$search_code = GETPOST('search_code','alpha');
-$search_societe = GETPOST('search_societe','alpha');
+$search_company = GETPOST('search_company','alpha');
$statut = GETPOST('statut','int');
$bon=new BonPrelevement($db,"");
@@ -53,7 +53,14 @@ $ligne=new LignePrelevement($db,$user);
$offset = $conf->liste_limit * $page ;
-
+if (GETPOST("button_removefilter"))
+{
+ $search_line="";
+ $search_bon="";
+ $search_code="";
+ $search_company="";
+ $statut="";
+}
/*
* View
@@ -88,9 +95,9 @@ if ($search_code)
{
$sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'";
}
-if ($search_societe)
+if ($search_company)
{
- $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
+ $sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
}
$sql.=$db->order($sortfield,$sortorder);
$sql.=$db->plimit($conf->liste_limit+1, $offset);
@@ -122,15 +129,17 @@ if ($result)
print '';
$var=True;
diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php
index 1fecc0e1c28..b586241c11e 100644
--- a/htdocs/compta/resultat/index.php
+++ b/htdocs/compta/resultat/index.php
@@ -560,7 +560,7 @@ print ' ';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
- print '';
+ print ' ';
print '';
print $annee;
if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1);
@@ -571,7 +571,7 @@ print ''.$langs->trans("Month").
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
print ' '.$langs->trans("Outcome").' ';
- print ''.$langs->trans("Income").' ';
+ print ''.$langs->trans("Income").' ';
}
print ' ';
@@ -601,7 +601,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
}
print " ";
- print ' ';
+ print ' ';
//if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0)
if (isset($encaiss_ttc[$case]))
{
@@ -623,7 +623,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
$nbcols+=2;
print ' '.(isset($totsorties[$annee])?price(price2num($totsorties[$annee],'MT')):' ').' ';
- print ''.(isset($totentrees[$annee])?price(price2num($totentrees[$annee],'MT')):' ').' ';
+ print ''.(isset($totentrees[$annee])?price(price2num($totentrees[$annee],'MT')):' ').' ';
}
print " \n";
@@ -637,7 +637,7 @@ $var=!$var;
print ''.$langs->trans("Profit").' ';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
- print ' ';
+ print ' ';
if (isset($totentrees[$annee]) || isset($totsorties[$annee]))
{
$in=(isset($totentrees[$annee])?price2num($totentrees[$annee], 'MT'):0);
diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php
index b2fc3e1b4a3..17c3efdbfaa 100644
--- a/htdocs/compta/salaries/index.php
+++ b/htdocs/compta/salaries/index.php
@@ -33,6 +33,9 @@ $socid = GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'salaries', '', '', '');
+$search_ref = GETPOST('search_ref','int');
+$search_label = GETPOST('search_label','alpha');
+$search_amount = GETPOST('search_amount','alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
@@ -61,6 +64,14 @@ else
$typeid=$_REQUEST['typeid'];
}
+if (GETPOST("button_removefilter"))
+{
+ $search_ref="";
+ $search_label="";
+ $search_amount="";
+ $typeid="";
+}
+
/*
* View
*/
@@ -78,8 +89,11 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst
$sql.= " ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = s.fk_user";
$sql.= " AND s.entity = ".$conf->entity;
-if (GETPOST("search_label")) $sql.=" AND s.label LIKE '%".$db->escape(GETPOST("search_label"))."%'";
-if (GETPOST("search_amount")) $sql.=" AND s.amount = ".price2num(GETPOST("search_amount"));
+
+// Search criteria
+if ($search_ref) $sql.=" AND s.rowid=".$search_ref;
+if ($search_label) $sql.=" AND s.label LIKE '%".$db->escape($search_label)."%'";
+if ($search_amount) $sql.=" AND s.amount='".$db->escape(price2num(trim($search_amount)))."'";
if ($filtre) {
$filtre=str_replace(":","=",$filtre);
$sql .= " AND ".$filtre;
@@ -118,19 +132,23 @@ if ($result)
print " \n";
print '';
+ // Ref
+ print '';
+ print ' ';
+ print ' ';
print ' ';
- print ' ';
- print ' ';
+ // Label
+ print ' ';
print ' ';
// Type
print '';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
print ' ';
- print ' ';
- print '';
- print ' ';
- print ' ';
- print " \n";
+ // Amount
+ print ' ';
+ print ' ';
+ print ' ';
+ print " \n";
while ($i < min($num,$limit))
{
diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php
index 022aaf14ff0..db4bef2abe6 100644
--- a/htdocs/compta/sociales/index.php
+++ b/htdocs/compta/sociales/index.php
@@ -36,6 +36,9 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
+$search_ref = GETPOST('search_ref','int');
+$search_label = GETPOST('search_label','alpha');
+$search_amount = GETPOST('search_amount','alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
@@ -65,6 +68,15 @@ else
$typeid=$_REQUEST['typeid'];
}
+if (GETPOST("button_removefilter"))
+{
+ $search_ref="";
+ $search_label="";
+ $search_amount="";
+ $typeid="";
+ $year="";
+ $month="";
+}
/*
* View
@@ -85,7 +97,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;
-if (GETPOST("search_label")) $sql.=" AND cs.libelle LIKE '%".$db->escape(GETPOST("search_label"))."%'";
+
+// Search criteria
+if ($search_ref) $sql.=" AND cs.rowid=".$search_ref;
+if ($search_label) $sql.=" AND cs.libelle LIKE '%".$db->escape($search_label)."%'";
+if ($search_amount) $sql.=" AND cs.amount='".$db->escape(price2num(trim($search_amount)))."'";
if ($year > 0)
{
$sql .= " AND (";
@@ -139,10 +155,8 @@ if ($resql)
{
print '