Merge remote-tracking branch 'Upstream/develop' into develop-loan

This commit is contained in:
aspangaro 2014-11-04 20:57:05 +01:00
commit cbfa90abca
34 changed files with 915 additions and 691 deletions

View File

@ -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 '</table>';
print '</form>';
//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 '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3"> '.$langs->trans("PasswordPatternDesc").'</td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("MinLength")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[0].'" id="minlenght" min="1"></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("NbMajMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[1].'" id="NbMajMin" min="0"></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("NbNumMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[2].'" id="NbNumMin" min="0"></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("NbSpeMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[3].'" id="NbSpeMin" min="0"></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("NbIteConsecutive")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[4].'" id="NbIteConsecutive" min="0"></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("NoAmbiCaracAutoGeneration")."</td>";
print '<td colspan="2"><input type="checkbox" id="NoAmbiCaracAutoGeneration" '.($tabConf[5] ? "checked" : "").' min="0"> <span id="textcheckbox">'.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'</span></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td colspan="2"></td><td width="103" align="center"><a id="linkChangePattern">'.$langs->trans("Save").'</a></td>';
print '</tr>';
print '</table>';
print '<script type="text/javascript">';
print ' function getStringArg(){';
print ' var pattern = "";';
print ' pattern += $("#minlenght").val() + ";";';
print ' pattern += $("#NbMajMin").val() + ";";';
print ' pattern += $("#NbNumMin").val() + ";";';
print ' pattern += $("#NbSpeMin").val() + ";";';
print ' pattern += $("#NbIteConsecutive").val() + ";";';
print ' pattern += $("#NoAmbiCaracAutoGeneration")[0].checked ? "1" : "0";';
print ' return pattern;';
print ' }';
print ' function valuePossible(){';
print ' var length = parseInt($("#minlenght").val());';
print ' var length_mini = parseInt($("#NbMajMin").val()) + parseInt($("#NbNumMin").val()) + parseInt($("#NbSpeMin").val());';
print ' return length >= length_mini;';
print ' }';
print ' function generatelink(){';
print ' return "security.php?action=maj_pattern&pattern="+getStringArg();';
print ' }';
print ' function valuePatternChange(){';
print ' var lang_save = "'.$langs->trans("Save").'";';
print ' var lang_error = "'.$langs->trans("Error").'";';
print ' var lang_Disabled = "'.$langs->trans("Disabled").'";';
print ' var lang_Activated = "'.$langs->trans("Activated").'";';
print ' $("#textcheckbox").html($("#NoAmbiCaracAutoGeneration")[0].checked ? unescape(lang_Activated) : unescape(lang_Disabled));';
print ' if(valuePossible()){';
print ' $("#linkChangePattern").attr("href",generatelink()).text(lang_save);';
print ' }';
print ' else{';
print ' $("#linkChangePattern").attr("href", null).text(lang_error);';
print ' }';
print ' }';
print ' $("#minlenght").change(function(){valuePatternChange();});';
print ' $("#NbMajMin").change(function(){valuePatternChange();});';
print ' $("#NbNumMin").change(function(){valuePatternChange();});';
print ' $("#NbSpeMin").change(function(){valuePatternChange();});';
print ' $("#NbIteConsecutive").change(function(){valuePatternChange();});';
print ' $("#NoAmbiCaracAutoGeneration").change(function(){valuePatternChange();});';
print '</script>';
}
// Cryptage mot de passe
print '<br>';
$var=true;

View File

@ -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 .= '<br>' . $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)

View File

@ -322,8 +322,11 @@ if ($result)
print '<td class="liste_titre" align="right">';
$formpropal->selectProposalStatus($viewstatut,1);
print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print '<td class="liste_titre" align="right">';
print '<input type="image" value="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp;';
print '<input type="image" value="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print "</tr>\n";
$var=true;

View File

@ -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").' <select class="flat" name="search_level_from">'.$options_from.'</select>';
print ' ';
print $langs->trans("To").' <select class="flat" name="search_level_to">'.$options_to.'</select>';
print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>';
print '</td>';
@ -378,9 +392,9 @@ if ($resql)
print '</td>';
// Print the search button
print '<td class="liste_titre" align="right">';
print '<input class="liste_titre" name="button_search" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook

View File

@ -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 .= '<br>' . $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') {

View File

@ -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 '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="center">';
$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 '</td>';
print '<td class="liste_titre"><input type="text" class="flat" name="req_nb" value="'.GETPOST("req_nb").'" size="2"></td>';
print '<td class="liste_titre">';
@ -214,9 +224,9 @@ if ($resql)
print '<td class="liste_titre" align="right">';
print '<input type="hidden" name="action" value="search">';
if (! empty($_REQUEST['bid'])) print '<input type="hidden" name="bid" value="'.$_REQUEST["bid"].'">';
print '<input type="image" class="liste_titre" name="submit" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print '</tr>';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
// Loop on each record
$total_debit=0;

View File

@ -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 "<tr class=\"liste_titre\">";
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 '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'">';
print '<input class="flat" size="4" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td class="liste_titre">';
//print '<input class="flat" size="10" type="text" name="search_company" value="'.$search_company.'">';
print '&nbsp;';
print '</td>';
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>';
print '<td class="liste_titre">';
//print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">';
print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">';
print '</td>';
print '<td class="liste_titre" align="left">';
print '&nbsp;';
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_company" value="'.$search_company.'">';
print '</td>';
print '<td class="liste_titre" align="right">';
print '&nbsp;';
print '</td>';
print '<td class="liste_titre" align="right">';
print '&nbsp;';
// print '<input class="flat" size="10" type="text" name="search_amount" value="'.$search_amount.'">';
print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
$var=true;
@ -142,9 +183,9 @@ if ($resql)
// Type
print '<td>'.$langs->trans($obj->type).'</td>';
// Date
print '<td>'.dol_print_date($db->jdate($obj->dd),'day').'</td>';
print '<td align="center">'.dol_print_date($db->jdate($obj->dd),'day').'</td>';
// User
print '<td align="left">';
print '<td>';
$userstatic->id = $obj->rowid;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;

View File

@ -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 '&nbsp;';
print '</td>';
}
print '<td class="liste_titre" align="right">';
print '&nbsp;';
print '</td>';
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print "</td></tr>\n";
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
$var=True;
while ($i < min($num,$limit))

View File

@ -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 .= '<br>' . $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();

View File

@ -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 '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$params,"",$sortfield,$sortorder);
@ -117,7 +130,7 @@ if ($resql)
// Lignes des champs de filtre
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">';
print '<input class="fat" type="text" size="4" name="search_ref" value="'.GETPOST('search_ref').'">';
print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
@ -125,16 +138,15 @@ if ($resql)
$formother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>';
print '<td>';
$form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1);
$form->select_comptes($search_account,'search_account',0,'',1);
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
print '<input class="fat" type="text" size="6" name="search_amount" value="'.GETPOST('search_amount').'">';
print '<input class="flat" type="text" size="6" name="search_amount" value="'.$search_amount.'">';
print '</td>';
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print "</tr>\n";
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
$var=true;
while ($i < min($num,$limit))

View File

@ -42,6 +42,11 @@ $paymentstatic=new Paiement($db);
$accountstatic=new Account($db);
$companystatic=new Societe($db);
$search_ref=GETPOST("search_ref","int");
$search_account=GETPOST("search_account","int");
$search_paymenttype=GETPOST("search_paymenttype");
$search_amount=GETPOST("search_amount");
$search_company=GETPOST("search_company");
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
@ -53,8 +58,14 @@ $limit = $conf->liste_limit;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="p.rowid";
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_account="";
$search_amount="";
$search_paymenttype="";
$search_company="";
}
/*
* View
@ -110,11 +121,11 @@ else
else $sql.= " AND f.fk_user_author = ".$userid;
}
// Search criteria
if (GETPOST("search_ref")) $sql .=" AND p.rowid=".GETPOST("search_ref",'int');
if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int');
if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".GETPOST("search_paymenttype")."'";
if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount"));
if (GETPOST("search_company")) $sql .= natural_search('s.nom', GETPOST('search_company'));
if ($search_ref) $sql .=" AND p.rowid=".$search_ref;
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
if ($search_paymenttype != "") $sql .=" AND c.code='".$search_paymenttype."'";
if ($search_amount) $sql .=" AND p.amount='".price2num($search_amount)."'";
if ($search_company) $sql .= natural_search('s.nom', $search_company);
}
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);
@ -129,9 +140,9 @@ if ($resql)
$paramlist='';
$paramlist.=(GETPOST("orphelins")?"&orphelins=1":"");
$paramlist.=($_REQUEST["search_ref"]?"&search_ref=".$_REQUEST["search_ref"]:"");
$paramlist.=($_REQUEST["search_company"]?"&search_company=".$_REQUEST["search_company"]:"");
$paramlist.=($_REQUEST["search_amount"]?"&search_amount=".$_REQUEST["search_amount"]:"");
$paramlist.=($search_ref?"&search_ref=".$search_ref:"");
$paramlist.=($search_company?"&search_company=".$search_company:"");
$paramlist.=($search_amount?"&search_amount=".$search_amount:"");
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num);
@ -149,26 +160,29 @@ if ($resql)
{
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder);
}
print "</tr>\n";
print '<td class="liste_titre">&nbsp;</td>';
print "</tr>\n";
// Lines for filters fields
print '<tr class="liste_titre">';
print '<td align="left">';
print '<input class="fat" type="text" size="4" name="search_ref" value="'.$_REQUEST["search_ref"].'">';
print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td>&nbsp;</td>';
print '<td align="left">';
print '<input class="fat" type="text" size="6" name="search_company" value="'.$_REQUEST["search_company"].'">';
print '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
print '</td>';
print '<td>';
$form->select_types_paiements($_REQUEST["search_paymenttype"],'search_paymenttype','',2,1,1);
$form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1);
print '</td>';
print '<td>';
$form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1);
$form->select_comptes($search_account,'search_account',0,'',1);
print '</td>';
print '<td align="right">';
print '<input class="fat" type="text" size="4" name="search_amount" value="'.$_REQUEST["search_amount"].'">';
print '<input class="flat" type="text" size="4" name="search_amount" value="'.$search_amount.'">';
print '</td><td align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
@ -223,7 +237,8 @@ if ($resql)
if ($objp->statut == 0) print '</a>';
print '</td>';
}
print '<td>&nbsp;</td>';
print '</tr>';
$i++;

View File

@ -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 '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_ligne" value="'. dol_escape_htmltag($search_line).'" size="6"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'. dol_escape_htmltag($search_line).'" size="6"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'. dol_escape_htmltag($search_bon).'" size="8"></td>';
print '<td>&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" value="'. dol_escape_htmltag($search_societe).'" size="12"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'. dol_escape_htmltag($search_company).'" size="12"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'. dol_escape_htmltag($search_code).'" size="8"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
print '</tr>';
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '</form>';
$var=True;

View File

@ -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 "</tr>\n";
print '<tr class="liste_titre">';
// Ref
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.GETPOST("search_label").'"></td>';
// Label
print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.$search_label.'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
// Type
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
print '</td>';
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.GETPOST("search_amount").'"></td>';
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print "</tr>\n";
// Amount
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
while ($i < min($num,$limit))
{

View File

@ -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 '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
@ -153,20 +167,26 @@ if ($resql)
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_label" value="'.GETPOST("search_label").'"></td>';
// Ref
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
print '</td>';
// Label
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_label" value="'.$search_label.'"></td>';
// Type
print '<td class="liste_titre" align="left">';
$formsocialcontrib->select_type_socialcontrib($typeid,'typeid',1,16,0);
print '</td>';
// Period end date
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
// Amount
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input class="flat" type="text" size="6" name="search_amount" value="'.$search_amount.'">';
print '</td>';
print "</tr>\n";
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
while ($i < min($num,$limit))
{

View File

@ -35,6 +35,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');
@ -63,6 +66,14 @@ else
$typeid=$_REQUEST['typeid'];
}
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_label="";
$search_amount="";
$typeid="";
}
/*
* View
*/
@ -76,8 +87,9 @@ $sql = "SELECT t.rowid, t.amount, t.label, t.datev as dm, t.fk_typepayment as ty
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id";
$sql.= " WHERE t.entity = ".$conf->entity;
if (GETPOST("search_label")) $sql.=" AND t.label LIKE '%".$db->escape(GETPOST("search_label"))."%'";
if (GETPOST("search_amount")) $sql.=" AND t.amount = ".price2num(GETPOST("search_amount"));
if ($search_ref) $sql.=" AND t.rowid=".$search_ref;
if ($search_label) $sql.=" AND t.label LIKE '%".$db->escape($search_label)."%'";
if ($search_amount) $sql.=" AND t.amount='".$db->escape(price2num(trim($search_amount)))."'";
if ($filtre) {
$filtre=str_replace(":","=",$filtre);
$sql .= " AND ".$filtre;
@ -106,27 +118,26 @@ if ($result)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dm","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("");
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dm","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("");
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.GETPOST("search_label").'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="4" name="search_ref" value="'.$search_ref.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.$search_label.'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
// Type
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
print '</td>';
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.GETPOST("search_amount").'"></td>';
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print "</tr>\n";
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
while ($i < min($num,$limit))
{

View File

@ -357,7 +357,7 @@ if ($result)
print '</td>';
print '<td class="liste_titre" align="right">';
print '<input type="image" value="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp; ';
print '&nbsp;';
print '<input type="image" value="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '</tr>';

View File

@ -40,11 +40,11 @@ if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
$search_nom=GETPOST('search_nom');
$search_name=GETPOST('search_name');
$search_contract=GETPOST('search_contract');
$search_ref_supplier=GETPOST('search_ref_supplier','alpha');
$sall=GETPOST('sall');
$statut=GETPOST('statut')?GETPOST('statut'):1;
$search_status=GETPOST('search_status');
$socid=GETPOST('socid');
if (! $sortfield) $sortfield="c.rowid";
@ -58,6 +58,17 @@ $result = restrictedArea($user, 'contrat', $id);
$staticcontrat=new Contrat($db);
$staticcontratligne=new ContratLigne($db);
if (GETPOST("button_removefilter"))
{
$search_name="";
$search_contract="";
$search_ref_supplier="";
$sall="";
$search_status="";
}
if ($search_status == '') $search_status=1;
/*
* View
@ -84,8 +95,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 ($search_nom) {
$sql .= natural_search('s.nom', $search_nom);
if ($search_name) {
$sql .= natural_search('s.nom', $search_name);
}
if ($search_contract) {
$sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
@ -106,13 +117,13 @@ if ($resql)
$num = $db->num_rows($resql);
$i = 0;
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_nom='.$search_nom, $sortfield, $sortorder,'',$num);
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_name='.$search_name, $sortfield, $sortorder,'',$num);
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
$param='&amp;search_contract='.$search_contract;
$param.='&amp;search_nom='.$search_nom;
$param.='&amp;search_name='.$search_name;
$param.='&amp;search_ref_supplier='.$search_ref_supplier;
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
@ -136,13 +147,13 @@ if ($resql)
print '<input type="text" class="flat" size="7" name="search_ref_supplier value="'.$search_ref_supplier.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="24" name="search_nom" value="'.$search_nom.'">';
print '<input type="text" class="flat" size="24" name="search_name" value="'.$search_name.'">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
//print '<td class="liste_titre">&nbsp;</td>';
print '<td colspan="4" class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print "</td>";
print "</tr>\n";
print '<td colspan="4" class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
print '</form>';
$var=true;

View File

@ -44,7 +44,7 @@ if (! $sortfield) $sortfield="c.rowid";
if (! $sortorder) $sortorder="ASC";
$filter=GETPOST("filter");
$search_nom=GETPOST("search_nom");
$search_name=GETPOST("search_name");
$search_contract=GETPOST("search_contract");
$search_service=GETPOST("search_service");
$statut=GETPOST('statut')?GETPOST('statut'):1;
@ -69,6 +69,21 @@ $staticcontrat=new Contrat($db);
$staticcontratligne=new ContratLigne($db);
$companystatic=new Societe($db);
if (GETPOST("button_removefilter"))
{
$search_name="";
$search_contract="";
$search_service="";
$op1month="";
$op1day="";
$op1year="";
$filter_op1="";
$op2month="";
$op2day="";
$op2year="";
$filter_op2="";
}
/*
* View
*/
@ -101,7 +116,7 @@ if ($mode == "0") $sql.= " AND cd.statut = 0";
if ($mode == "4") $sql.= " AND cd.statut = 4";
if ($mode == "5") $sql.= " AND cd.statut = 5";
if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'";
if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'";
if ($search_name) $sql.= " AND s.nom LIKE '%".$db->escape($search_name)."%'";
if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'";
if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
@ -122,7 +137,7 @@ if ($resql)
$param='';
if ($search_contract) $param.='&amp;search_contract='.urlencode($search_contract);
if ($search_nom) $param.='&amp;search_nom='.urlencode($search_nom);
if ($search_name) $param.='&amp;search_name='.urlencode($search_name);
if ($search_service) $param.='&amp;search_service='.urlencode($search_service);
if ($mode) $param.='&amp;mode='.$mode;
if ($filter) $param.='&amp;filter='.$filter;
@ -168,7 +183,7 @@ if ($resql)
print '</td>';
// Third party
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="24" name="search_nom" value="'.dol_escape_htmltag($search_nom).'">';
print '<input type="text" class="flat" size="24" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '</td>';
print '<td class="liste_titre" align="center">';
$arrayofoperators=array('<'=>'<','>'=>'>');
@ -184,9 +199,9 @@ if ($resql)
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
print $form->select_date($filter_date2,'op2',0,0,1);
print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print "</td>";
print "</tr>\n";
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
print '</form>';
$contractstatic=new Contrat($db);

View File

@ -87,10 +87,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($result > 0)
{
if ($_POST['sendto'])
if (trim($_POST['sendto']))
{
// Recipient is provided into free text
$sendto = $_POST['sendto'];
$sendto = trim($_POST['sendto']);
$sendtoid = 0;
}
elseif ($_POST['receiver'] != '-1')
@ -107,6 +107,22 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$sendtoid = $_POST['receiver'];
}
}
if (trim($_POST['sendtocc']))
{
$sendtocc = trim($_POST['sendtocc']);
}
elseif ($_POST['receivercc'] != '-1')
{
// Recipient was provided from combo list
if ($_POST['receivercc'] == 'thirdparty') // Id of third party
{
$sendtocc = $thirdparty->email;
}
else // Id du contact
{
$sendtocc = $thirdparty->contact_get_property($_POST['receivercc'],'email');
}
}
if (dol_strlen($sendto))
{
@ -115,8 +131,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
$message = $_POST['message'];
$sendtocc = $_POST['sendtocc'];
$sendtobcc='';
$sendtocc = $sendtocc;
$sendtobcc= GETPOST('sendtoccc');
if ($mode == 'emailfromproposal') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO);
if ($mode == 'emailfromorder') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO);
if ($mode == 'emailfrominvoice') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
@ -172,7 +188,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('COMPANY_SENTBYMAIL',$object,$user,$langs,$conf);
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}

View File

@ -1835,11 +1835,12 @@ class Form
* @param string $filterkey Filtre des produits
* @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $limit Limit of line number
* @return array Array of keys for json
*/
function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0)
function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100)
{
global $langs,$conf;
global $langs,$conf,$db;
$out='';
$outarray=array();
@ -1877,6 +1878,7 @@ class Form
$sql.=')';
}
$sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC";
$sql.= $db->plimit($limit);
// Build output string

View File

@ -173,6 +173,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
}
$("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified
}
,delay: 500
}).data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
.data( "item.autocomplete", item )

View File

@ -766,7 +766,7 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
* @param int $inhour 0: return number of days, 1: return number of hours
* @param int $lastday We include last day, 0: no, 1:yes
* @param int $halfday Tag to define half day when holiday start and end
* @param string $countrycode Country code (company country code if not defined)
* @param string $country_code Country code (company country code if not defined)
* @return int Number of days or hours
*/
function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')

View File

@ -0,0 +1,216 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
*
* 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 <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/security/generate/modGeneratePassPerso.class.php
* \ingroup core
* \brief File to manage no password generation.
*/
require_once DOL_DOCUMENT_ROOT .'/core/modules/security/generate/modules_genpassword.php';
/**
* \class modGeneratePassPerso
* \brief Class to generate a password according to personal rules
*/
class modGeneratePassPerso extends ModeleGenPassword
{
var $id;
var $length;
var $length2; // didn't overright display
var $NbMaj;
var $NbNum;
var $NbSpe;
var $NbRepeat;
var $WithoutAmbi;
var $db;
var $conf;
var $lang;
var $user;
var $Maj;
var $Min;
var $Nb;
var $Spe;
var $Ambi;
var $All;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param Conf $conf Handler de conf
* @param Translate $langs Handler de langue
* @param User $user Handler du user connecte
*/
function __construct($db, $conf, $langs, $user)
{
$this->id = "Perso";
$this->length = $langs->trans("SetupPerso");
$this->db=$db;
$this->conf=$conf;
$this->langs=$langs;
$this->user=$user;
if(empty($conf->global->USER_PASSWORD_PATTERN)){
// default value (8carac, 1maj, 1digit, 1spe, 3 repeat, no ambi at auto generation.
dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1','chaine',0,'',$conf->entity);
}
$this->Maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$this->Min = strtolower($this->Maj);
$this->Nb = "0123456789";
$this->Spe = "!@#$%&*()_-+={}[]\\|:;'/";
$this->Ambi = array("1","I","l","|","O","0");
$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];
if($this->WithoutAmbi){
$this->Maj = str_replace($this->Ambi,"",$this->Maj );
$this->Min = str_replace($this->Ambi,"",$this->Min );
$this->Nb = str_replace($this->Ambi,"",$this->Nb );
$this->Spe = str_replace($this->Ambi,"",$this->Spe );
}
$this->All = str_shuffle($this->Maj. $this->Min. $this->Nb. $this->Spe);
//$this->All = $this->Maj. $this->Min. $this->Nb. $this->Spe;
//$this->All = $this->Spe;
}
/**
* Return description of module
*
* @return string Description of text
*/
function getDescription()
{
global $langs;
return $langs->trans("PasswordGenerationPerso");
}
/**
* Return an example of password generated by this module
*
* @return string Example of password
*/
function getExample()
{
return $this->getNewGeneratedPassword();
}
/**
* Build new password
*
* @return string Return a new generated password
*/
function getNewGeneratedPassword()
{
$pass = "";
for($i=0; $i<$this->NbMaj; $i++){ // Y
$pass .= $this->Maj[rand(0,strlen($this->Maj) - 1)];
}
for($i=0; $i<$this->NbNum; $i++){ // X
$pass .= $this->Nb[rand(0,strlen($this->Nb) - 1)];
}
for($i=0; $i<$this->NbSpe; $i++){ // @
$pass .= $this->Spe[rand(0,strlen($this->Spe) - 1)];
}
for($i=strlen($pass);$i<$this->length2; $i++){ // y
$pass .= $this->All[rand(0,strlen($this->All) -1)];
}
$pass = str_shuffle($pass) ;
if($this->validatePassword($pass)) {
return $pass;
}
return $this->getNewGeneratedPassword();
}
/**
* Validate a password
*
* @param string $password Password to check
* @return int 0 if KO, >0 if OK
*/
function validatePassword($password)
{
$password_a = str_split($password);
$maj = str_split($this->Maj);
$num = str_split($this->Nb);
$spe = str_split($this->Spe);
if(count(array_intersect($password_a, $maj)) < $this->NbMaj){
return 0;
}
if(count(array_intersect($password_a, $num)) < $this->NbNum){
return 0;
}
if(count(array_intersect($password_a, $spe)) < $this->NbSpe){
return 0;
}
if(!$this->consecutiveInterationSameCharacter($password)){
return 0;
}
return 1;
}
/**
* consecutive iterations of the same character
*
* @param string $password Password to check
* @return int 0 if KO, >0 if OK
*/
function consecutiveInterationSameCharacter($password){
$last = "";
$count = 0;
$char = str_split($password);
foreach($char as $c){
if($c != $last){
$last = $c;
$count = 0;
}else{
$count++;
}
if($count >= $this->NbRepeat) {
return 0;
}
}
return 1;
}
}

View File

@ -62,6 +62,13 @@ $search_desc=GETPOST('search_desc','alpha');
$search_status=GETPOST('search_status');
$sall=GETPOST('sall');
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_company="";
$search_desc="";
$search_status="";
}
/*
* View
@ -131,6 +138,7 @@ if ($result)
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"], '');
print "</tr>\n";
print '<tr class="liste_titre">';
@ -151,9 +159,10 @@ if ($result)
print '<td class="liste_titre" align="right">';
$liststatus=$interventionstatic->statuts_short;
print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1, 0, 0, '', 1);
print '<input class="liste_titre" align="right" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print "</tr>\n";
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
$companystatic=new Societe($db);
@ -184,7 +193,8 @@ if ($result)
print '<td align="right">'.convertSecondToTime($objp->duree).'</td>';
}
print '<td align="right">'.$interventionstatic->LibStatut($objp->fk_statut,5).'</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
$total += $objp->duree;
@ -194,10 +204,10 @@ if ($result)
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
{
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td align="right" class="nowrap liste_total">'.convertSecondToTime($total).'</td><td>&nbsp;</td>';
print '<td align="right" class="nowrap liste_total">'.convertSecondToTime($total).'</td><td>&nbsp;</td><td>&nbsp;</td>';
print '</tr>';
}
print '</table>';
print "</form>\n";
$db->free($result);

View File

@ -47,6 +47,31 @@ if ($user->societe_id > 0)
$socid = $user->societe_id;
}
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$search_ref = GETPOST('search_ref','alpha');
$search_ref_supplier = GETPOST('search_ref_supplier','alpha');
$search_company = GETPOST('search_company','alpha');
$search_amount_no_tax = GETPOST('search_amount_no_tax','alpha');
$search_amount_all_tax = GETPOST('search_amount_all_tax','alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="f.date_lim_reglement";
if (! $sortorder) $sortorder="ASC";
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_ref_supplier="";
$search_company="";
$search_amount_no_tax="";
$search_amount_all_tax="";
}
/*
* View
@ -61,31 +86,6 @@ $title=$langs->trans("BillsSuppliersUnpaid");
$facturestatic=new FactureFournisseur($db);
$companystatic=new Societe($db);
/***************************************************************************
* *
* Mode Liste *
* *
***************************************************************************/
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$search_ref = GETPOST('search_ref','alpha');
$search_ref_supplier = GETPOST('search_ref_supplier','alpha');
$search_societe = GETPOST('search_societe','alpha');
$search_montant_ht = GETPOST('search_montant_ht','int');
$search_montant_ttc = GETPOST('search_montant_ttc','int');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="f.date_lim_reglement";
if (! $sortorder) $sortorder="ASC";
if ($user->rights->fournisseur->facture->lire)
{
$sql = "SELECT s.rowid as socid, s.nom as name,";
@ -124,19 +124,19 @@ if ($user->rights->fournisseur->facture->lire)
$sql .= " AND f.ref_supplier LIKE '%".$search_ref_supplier."%'";
}
if ($search_societe)
if ($search_company)
{
$sql .= " AND s.nom LIKE '%".$search_societe."%'";
$sql .= " AND s.nom LIKE '%".$search_company."%'";
}
if ($search_montant_ht)
if ($search_amount_no_tax)
{
$sql .= " AND f.total_ht = '".$search_montant_ht."'";
$sql .= " AND f.total_ht = '".$search_amount_no_tax."'";
}
if ($search_montant_ttc)
if ($search_amount_all_tax)
{
$sql .= " AND f.total_ttc = '".$search_montant_ttc."'";
$sql .= " AND f.total_ttc = '".$search_amount_all_tax."'";
}
if (dol_strlen(GETPOST('sf_re')) > 0)
@ -165,9 +165,9 @@ if ($user->rights->fournisseur->facture->lire)
if ($search_ref) $param.='&amp;search_ref='.urlencode($search_ref);
if ($search_ref_supplier) $param.='&amp;search_ref_supplier='.urlencode($search_ref_supplier);
if ($search_societe) $param.='&amp;search_societe='.urlencode($search_societe);
if ($search_montant_ht) $param.='&amp;search_montant_ht='.urlencode($search_montant_ht);
if ($search_montant_ttc) $param.='&amp;search_montant_ttc='.urlencode($search_montant_ttc);
if ($search_company) $param.='&amp;search_company='.urlencode($search_company);
if ($search_amount_no_tax) $param.='&amp;search_amount_no_tax='.urlencode($search_amount_no_tax);
if ($search_amount_all_tax) $param.='&amp;search_amount_all_tax='.urlencode($search_amount_all_tax);
$param.=($option?"&option=".$option:"");
if (! empty($late)) $param.='&late='.urlencode($late);
@ -209,15 +209,15 @@ if ($user->rights->fournisseur->facture->lire)
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="6" name="search_societe" value="'.$search_societe.'">';
print '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_montant_ht" value="'.$search_montant_ht.'">';
print '<input class="flat" type="text" size="8" name="search_amount_no_tax" value="'.$search_amount_no_tax.'">';
print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_montant_ttc" value="'.$search_montant_ttc.'">';
print '<input class="flat" type="text" size="8" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">';
print '</td><td class="liste_titre" colspan="2" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print "</tr>\n";
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
if ($num > 0)
{

View File

@ -64,9 +64,26 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="fac.datef,fac.rowid";
$month = GETPOST('month','int');
$year = GETPOST('year','int');
$search_ref = GETPOST("search_ref","int");
$search_ref_supplier = GETPOST("search_ref_supplier","alpha");
$search_label = GETPOST("search_label","alpha");
$search_company = GETPOST("search_company","alpha");
$search_amount_no_tax = GETPOST("search_amount_no_tax","alpha");
$search_amount_all_tax = GETPOST("search_amount_all_tax","alpha");
$month = GETPOST("month","int");
$year = GETPOST("year","int");
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_ref_supplier="";
$search_label="";
$search_company="";
$search_amount_no_tax="";
$search_amount_all_tax="";
$year="";
$month="";
}
/*
* Actions
@ -93,9 +110,6 @@ if ($mode == 'search')
}
}
/*
* View
*/
@ -132,14 +146,14 @@ if (GETPOST('filtre') && GETPOST('filtre') != -1) // GETPOST('filtre') may be a
}
}
if (GETPOST("search_ref"))
if ($search_ref)
{
if (is_numeric(GETPOST("search_ref"))) $sql .= natural_search(array('fac.rowid', 'fac.ref'), GETPOST('search_ref'));// For backward compatibility
else $sql .= natural_search('fac.ref', GETPOST("search_ref"));
if (is_numeric($search_ref)) $sql .= natural_search(array('fac.rowid', 'fac.ref'), $search_ref);// For backward compatibility
else $sql .= natural_search('fac.ref', $search_ref);
}
if (GETPOST("search_ref_supplier"))
if (search_ref_supplier)
{
$sql .= natural_search('fac.ref_supplier', GETPOST('search_ref_supplier'));
$sql .= natural_search('fac.ref_supplier', $search_ref_supplier);
}
if ($month > 0)
{
@ -152,24 +166,24 @@ else if ($year > 0)
{
$sql.= " AND fac.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
if (GETPOST("search_libelle"))
if ($search_label)
{
$sql .= natural_search('fac.libelle', GETPOST('search_libelle'));
$sql .= natural_search('fac.libelle', $search_label);
}
if (GETPOST("search_societe"))
if ($search_company)
{
$sql .= natural_search('s.nom', GETPOST('search_societe'));
$sql .= natural_search('s.nom', $search_company);
}
if (GETPOST("search_montant_ht"))
if ($search_amount_no_tax)
{
$sql .= " AND fac.total_ht = '".$db->escape(price2num(GETPOST("search_montant_ht")))."'";
$sql .= " AND fac.total_ht = '".$db->escape(price2num($search_amount_no_tax))."'";
}
if (GETPOST("search_montant_ttc"))
if ($search_amount_all_tax)
{
$sql .= " AND fac.total_ttc = '".$db->escape(price2num(GETPOST("search_montant_ttc")))."'";
$sql .= " AND fac.total_ttc = '".$db->escape(price2num($search_amount_all_tax))."'";
}
$nbtotalofrecords = 0;
@ -195,14 +209,14 @@ if ($resql)
}
$param='&socid='.$socid;
if ($month) $param.='&month='.urlencode($month);
if ($year) $param.='&year=' .urlencode($year);
if (GETPOST("search_ref")) $param.='&search_ref='.urlencode(GETPOST("search_ref"));
if (GETPOST("search_ref_supplier")) $param.='&search_ref_supplier'.urlencode(GETPOST("search_ref_supplier"));
if (GETPOST("search_libelle")) $param.='&search_libelle='.urlencode(GETPOST("search_libelle"));
if (GETPOST("search_societe")) $param.='&search_societe='.urlencode(GETPOST("search_societe"));
if (GETPOST("search_montant_ht")) $param.='&search_montant_ht='.urlencode(GETPOST("search_montant_ht"));
if (GETPOST("search_montant_ttc")) $param.='&search_montant_ttc='.urlencode(GETPOST("search_montant_ttc"));
if ($month) $param.='&month='.urlencode($month);
if ($year) $param.='&year=' .urlencode($year);
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_ref_supplier) $param.='&search_ref_supplier'.urlencode($search_ref_supplier);
if ($search_label) $param.='&search_label='.urlencode($search_label);
if ($search_company) $param.='&search_company='.urlencode($search_company);
if ($search_amount_no_tax) $param.='&search_amount_no_tax='.urlencode($search_amount_no_tax);
if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax);
if (GETPOST("filtre") && GETPOST('filtre') != -1) $param.='&filtre='.urlencode(GETPOST("filtre"));
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
@ -218,17 +232,18 @@ if ($resql)
if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"fac.total_ht","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"fac.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="right"',$sortfield,$sortorder);
print '<td class="liste_titre">&nbsp;</td>';
print "</tr>\n";
// Lignes des champs de filtre
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.GETPOST("search_ref").'">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.GETPOST("search_ref_supplier").'">';
print '<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$search_ref_supplier.'">';
print '</td>';
print '<td class="liste_titre" colspan="1" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
@ -239,10 +254,10 @@ if ($resql)
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="16" type="text" name="search_libelle" value="'.GETPOST("search_libelle").'">';
print '<input class="flat" size="16" type="text" name="search_label" value="'.$search_label.'">';
print '</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="8" name="search_societe" value="'.GETPOST("search_societe").'">';
print '<input class="flat" type="text" size="8" name="search_company" value="'.$search_company.'">';
print '</td>';
if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS))
{
@ -250,13 +265,15 @@ if ($resql)
print '</td>';
}
print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_montant_ht" value="'.GETPOST("search_montant_ht").'">';
print '<input class="flat" type="text" size="8" name="search_amount_no_tax" value="'.$search_amount_no_tax.'">';
print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">';
print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_montant_ttc" value="'.GETPOST("search_montant_ttc").'">';
print '</td><td class="liste_titre" align="center">';
$liststatus=array('paye:0'=>$langs->trans("Unpayed"), 'paye:1'=>$langs->trans("Payed"));
print $form->selectarray('filtre', $liststatus, GETPOST('filtre'), 1);
print '<input type="image" class="liste_titre" align="right" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td><td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print "</tr>\n";
@ -312,6 +329,8 @@ if ($resql)
//print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$objp->am);
print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5);
print '</td>';
print '<td align="center">&nbsp;</td>';
print "</tr>\n";
$i++;
@ -325,6 +344,7 @@ if ($resql)
print '<td class="liste_total" align="right">'.price($total).'</td>';
print '<td class="liste_total" align="right">'.price($total_ttc).'</td>';
print '<td class="liste_total" align="center">&nbsp;</td>';
print '<td class="liste_total" align="center">&nbsp;</td>';
print "</tr>\n";
}
}

View File

@ -458,6 +458,15 @@ if (empty($action))
$search_paymenttype=GETPOST('search_paymenttype');
$search_amount=GETPOST('search_amount');
$search_company=GETPOST('search_company');
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_account="";
$search_paymenttype="";
$search_amount="";
$search_company="";
}
$sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,';
$sql.= ' s.rowid as socid, s.nom as name,';
@ -494,7 +503,7 @@ if (empty($action))
}
if (! empty($search_amount))
{
$sql .= " AND p.amount=".price2num($search_amount);
$sql .= " AND p.amount='".price2num($search_amount)."'";
}
if (! empty($search_company))
{
@ -515,7 +524,7 @@ if (empty($action))
$paramlist='';
$paramlist.=(! empty($search_ref)?"&search_ref=".$search_ref:"");
$paramlist.=(! empty($search_company)?"&search_company=".$search_company:"");
$paramlist.=(! empty($search_amount)?"&search_amount=".$search_amount:"");
$paramlist.=(! empty($search_amount)?"&search_amount='".$search_amount:"");
print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num);
@ -529,16 +538,17 @@ if (empty($action))
print_liste_field_titre($langs->trans('Account'),$_SERVER["PHP_SELF"],'ba.label','',$paramlist,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'f.amount','',$paramlist,'align="right"',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'ref_supplier','',$paramlist,'',$sortfield,$sortorder);
print "</tr>\n";
print '<td class="liste_titre">&nbsp;</td>';
print "</tr>\n";
// Lines for filters fields
print '<tr class="liste_titre">';
print '<td align="left">';
print '<input class="fat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td>&nbsp;</td>';
print '<td align="left">';
print '<input class="fat" type="text" size="6" name="search_company" value="'.$search_company.'">';
print '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
print '</td>';
print '<td>';
$form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1);
@ -547,9 +557,11 @@ if (empty($action))
$form->select_comptes($search_account,'search_account',0,'',1);
print '</td>';
print '<td align="right">';
print '<input class="fat" type="text" size="4" name="search_amount" value="'.$search_amount.'">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" alt="'.$langs->trans("Search").'">';
print '</td>';
print '<input class="flat" type="text" size="4" name="search_amount" value="'.$search_amount.'">';
print '</td><td align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print "</tr>\n";
while ($i < min($num,$limit))
@ -584,7 +596,8 @@ if (empty($action))
print '<td class="nowrap">';
print $invoicesupplierstatic->getNomUrl(1);
print '</td>';*/
print '<td>&nbsp;</td>';
print '</tr>';
$i++;
}

View File

@ -32,15 +32,15 @@ $langs->load("suppliers");
$langs->load("orders");
$langs->load("companies");
$socname = GETPOST("socname");
$search_nom = GETPOST("search_nom");
$search_zipcode = GETPOST("search_zipcode");
$search_town = GETPOST("search_town");
$search_code_fournisseur = GETPOST("search_code_fournisseur");
$search_compta_fournisseur = GETPOST("search_compta_fournisseur");
$search_datec = GETPOST("search_datec");
$search_categ = GETPOST('search_categ','int');
$catid = GETPOST("catid",'int');
$socname = GETPOST("socname");
$search_name = GETPOST("search_name");
$search_zipcode = GETPOST("search_zipcode");
$search_town = GETPOST("search_town");
$search_supplier_code = GETPOST("search_supplier_code");
$search_supplier_accounting = GETPOST("search_supplier_accounting");
$search_datec = GETPOST("search_datec");
$search_categ = GETPOST('search_categ','int');
$catid = GETPOST("catid",'int');
// Security check
$socid = GETPOST('socid','int');
@ -60,6 +60,19 @@ if (! $sortfield) $sortfield="nom";
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('supplierlist'));
if (GETPOST("button_removefilter_x"))
{
$socname="";
$search_name="";
$search_zipcode="";
$search_town="";
$search_supplier_code="";
$search_supplier_accounting="";
$search_datec="";
$search_categ="";
$catid="";
}
/*
* Actions
*/
@ -95,15 +108,15 @@ if ($socname) {
$sortfield = "s.nom";
$sortorder = "ASC";
}
if ($search_nom) {
$sql .= natural_search('s.nom', $search_nom);
if ($search_name) {
$sql .= natural_search('s.nom', $search_name);
}
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
if ($search_town) {
$sql .= natural_search('s.town', $search_town);
}
if ($search_code_fournisseur) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_code_fournisseur)."%'";
if ($search_compta_fournisseur) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_compta_fournisseur)."%'";
if ($search_supplier_code) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_supplier_code)."%'";
if ($search_supplier_accounting) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_supplier_accounting)."%'";
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
if ($catid > 0) $sql.= " AND cf.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cf.fk_categorie IS NULL";
@ -126,7 +139,7 @@ if ($resql)
$num = $db->num_rows($resql);
$i = 0;
$param = "&amp;search_nom=".$search_nom."&amp;search_code_fournisseur=".$search_code_fournisseur."&amp;search_zipcode=".$search_zipcode."&amp;search_town=".$search_town;
$param = "&amp;search_name=".$search_name."&amp;search_supplier_code=".$search_supplier_code."&amp;search_zipcode=".$search_zipcode."&amp;search_town=".$search_town;
if ($search_categ != '') $param.='&amp;search_categ='.$search_categ;
print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
@ -166,26 +179,28 @@ if ($resql)
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_nom" value="'.$search_nom.'"></td>';
print '<td class="liste_titre"><input type="text" size="10" class="flat" name="search_name" value="'.$search_name.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_zipcode" value="'.$search_zipcode.'"></td>';
print '<td class="liste_titre"><input type="text" size="10" class="flat" name="search_zipcode" value="'.$search_zipcode.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_town" value="'.$search_town.'"></td>';
print '<td class="liste_titre"><input type="text" size="10" class="flat" name="search_town" value="'.$search_town.'"></td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_code_fournisseur" value="'.$search_code_fournisseur.'">';
print '<input class="flat" type="text" size="10" name="search_supplier_code" value="'.$search_supplier_code.'">';
print '</td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_compta_fournisseur" value="'.$search_compta_fournisseur.'">';
print '<input class="flat" type="text" size="10" name="search_supplier_accounting" value="'.$search_supplier_accounting.'">';
print '</td>';
print '<td align="right" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_datec" value="'.$search_datec.'">';
print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook

View File

@ -64,6 +64,19 @@ $search_employe = GETPOST('search_employe');
$search_valideur = GETPOST('search_valideur');
$search_statut = GETPOST('select_statut');
if (GETPOST("button_removefilter"))
{
$search_ref="";
$month_create="";
$year_create="";
$month_start="";
$year_start="";
$month_end="";
$year_end="";
$search_employe="";
$search_valideur="";
$search_statut="";
}
/*
* Actions
@ -71,8 +84,6 @@ $search_statut = GETPOST('select_statut');
// None
/*
* View
*/
@ -257,7 +268,7 @@ print_liste_field_titre($langs->trans("Employe"),$_SERVER["PHP_SELF"],"cp.fk_use
print_liste_field_titre($langs->trans("ValidatorCP"),$_SERVER["PHP_SELF"],"cp.fk_validator","",'','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date_debut","",'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="center"',$sortfield,$sortorder);
print '<td></td>';
print "</tr>\n";
@ -323,7 +334,8 @@ print '</td>';
// ACTION
print '<td align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" alt="'.$langs->trans('Search').'">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print "</tr>\n";

View File

@ -610,6 +610,21 @@ IMG;
closedir($handle);
}
}
/**
* return the value present on odt in [valuename][/valuename]
* @param string $value name balise in the template
* @return string the value inside the balise
*
*/
public function getvalue($valuename)
{
$searchreg="/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/";
preg_match($searchreg, $this->contentXml, $matches);
$this->contentXml = preg_replace($searchreg, "", $this->contentXml);
return $matches[1];
}
}
?>

View File

@ -187,3 +187,17 @@ UPDATE llx_projet_task_time set task_datehour = task_date where task_datehour IS
-- update llx_facturedet set total_tva = total_ttc - total_ht where total_vat = 0;
-- update llx_facture set total = round(total_ttc / 1.2, 5) where total_ht = total_ttc;
-- update llx_facture set tva = total_ttc - total where tva = 0;
-- To insert elements into a category
-- Search idcategory: select rowid from llx_categorie where type=0 and label like '%xxx%'
-- Select all products to include: select * from llx_product where label like '%xxx%'
-- If ok, insert: insert into llx_categorie_product(fk_categorie, fk_product) select idcategory, rowid from llx_product where label like '%xxx%'
-- Replace xxx with your IP Address
-- bind-address = xxx.xxx.xxx.xxx
-- CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
-- CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
-- GRANT ALL ON *.* TO 'myuser'@'localhost';
-- GRANT ALL ON *.* TO 'myuser'@'%';
-- flush privileges;

View File

@ -3,6 +3,7 @@
-- Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
-- Copyright (C) 2010 Juanjo Menent <dolibarr@2byte.es>
-- Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
--
-- 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
@ -91,7 +92,7 @@ create table llx_societe
default_lang varchar(6), -- default language
logo varchar(255),
canvas varchar(32), -- type of canvas if used (null by default)
import_key varchar(14) -- import key
import_key varchar(14), -- import key
webservices_url varchar(255), -- supplier webservice url
webservices_key varchar(128), -- supplier webservice key
webservices_key varchar(128) -- supplier webservice key
)ENGINE=innodb;

View File

@ -327,6 +327,12 @@ ModuleDisabled=Module désactivé
ModuleDisabledSoNoEvent=Module désactivé donc événement jamais créé
ConfirmPurge=Êtes-vous sûr de vouloir réaliser cette purge ?<br>Ceci effacera définitivement tous vos fichiers (espace GED, pièces jointes, etc...).
MinLength=Longueur minimale
NbMajMin=Nombre de majuscule minimum
NbNumMin=Nombre de chiffre minimum
NbSpeMin=Nombre de caractère speciaux minimum
NbIteConsecutive=Nombre maximum d'iterations consecutive du même caractère
NoAmbiCaracAutoGeneration=Ne pas utiliser les caractère ambigus pour la generation automatique ("1","I","l","|","0","O")
SetupPerso=Configuration personalisable
LanguageFilesCachedIntoShmopSharedMemory=Fichiers .lang en mémoire partagée
ExamplesWithCurrentSetup=Exemples avec le paramétrage actif courant
ListOfDirectories=Liste des répertoires des modèles OpenDocument
@ -1063,6 +1069,8 @@ EmptyNumRefModelDesc=Code libre sans vérification. Peut être modifié à tout
##### Module password generation
PasswordGenerationStandard=Renvoie un mot de passe généré selon l'algorithme interne de Dolibarr : 8 caractères, chiffres et caractères en minuscules mélangés.
PasswordGenerationNone=Ne propose pas de mots de passe générés. Le mot de passe est à saisir manuellement.
PasswordGenerationPerso=Renvoie un mot de passe généré selon votre configuration.
PasswordPatternDesc=Pattern utilisé pour la génération de password personalisé
##### Users setup #####
UserGroupSetup=Configuration module utilisateurs et groupes
GeneratePassword=Proposer un mot de passe généré

View File

@ -520,6 +520,7 @@ if (empty($reshook))
// Actions to send emails
$id=$socid;
$actiontypecode='AC_OTH_AUTO';
$trigger_name='COMPANY_SENTBYMAIL';
$paramname='socid';
$mode='emailfromthirdparty';
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';