Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop

This commit is contained in:
Darkjeff 2017-08-10 14:49:09 +02:00
commit 855728ccb1
1136 changed files with 12766 additions and 5664 deletions

View File

@ -147,8 +147,12 @@ Following changes may create regression for some external modules, but were nece
* Removed Societe::set_commnucation_level (was deprecated in 4.0). Was not used.
* Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still
exists, but if an external module need action on it, it must provides itself its trigger file.
* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode
* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode. So, if you set var
$multicompany_transverse_mode to 1 into your conf file, you must remove this line and a new key into
the Home - setup - other admin page.
* Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx')
* Some other change were done in the way we read permission of a user when module multicompany is enabled. You can
retreive the old behavior by adding constant MULTICOMPANY_BACKWARD_COMPATIBILITY to 1.
* The hook formObjectOptions was not implemented correctly in previous version. Sometimes, you had to return output
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
hook specifications so you must return output into "resprint".

View File

@ -336,17 +336,17 @@ if ($result)
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("OnSell"), $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("OnBuy"), $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder);
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$fieldtosortaccount="p.accountancy_code_buy";
}
else $fieldtosortaccount="p.accountancy_code_sell";
print_liste_field_titre($langs->trans("CurrentDedicatedAccountingAccount"), $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AssignDedicatedAccountingAccount"));
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AssignDedicatedAccountingAccount");
$clickpitco=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($clickpitco, '', '', '', '', 'align="center"');
print '</tr>';

View File

@ -195,11 +195,11 @@ else {
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";

View File

@ -567,13 +567,13 @@ if ($action == 'create') {
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("AccountAccountingShort"));
print_liste_field_titre($langs->trans("SubledgerAccount"));
print_liste_field_titre($langs->trans("Labelcompte"));
print_liste_field_titre($langs->trans("Label"));
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="right"');
print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="right"');
print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"');
print_liste_field_titre("AccountAccountingShort");
print_liste_field_titre("SubledgerAccount");
print_liste_field_titre("Labelcompte");
print_liste_field_titre("Label");
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"');
print "</tr>\n";

View File

@ -436,15 +436,15 @@ print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("SubledgerAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
$checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);

View File

@ -244,14 +244,14 @@ print $searchpicto;
print '</td>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF']);
print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"));
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']);
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Label");
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";

View File

@ -201,19 +201,19 @@ print '</div>';
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print_liste_field_titre("NumPiece", $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Doctype", $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("ThirdPartyAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Sens", $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
print '<tr class="liste_titre">';

View File

@ -191,17 +191,17 @@ llxHeader ( '', 'Compta - Grand Livre' );
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td></td>';
print_liste_field_titre ( $langs->trans ( "Doctype" ), "liste.php", "bk.doc_type" );
print_liste_field_titre ( $langs->trans ( "Docdate" ), "liste.php", "bk.doc_date" );
print_liste_field_titre ( $langs->trans ( "Docref" ), "liste.php", "bk.doc_ref" );
// print_liste_field_titre ( $langs->trans ( "Numerocompte" ), "liste.php", "bk.numero_compte" );
// print_liste_field_titre ( $langs->trans ( "Code_tiers" ), "liste.php", "bk.code_tiers" );
print_liste_field_titre ( $langs->trans ( "Labelcompte" ), "liste.php", "bk_label_compte" );
print_liste_field_titre ( $langs->trans ( "Debit" ), "liste.php", "bk.debit" );
print_liste_field_titre ( $langs->trans ( "Credit" ), "liste.php", "bk.credit" );
// print_liste_field_titre ( $langs->trans ( "Amount" ), "liste.php", "bk.montant" );
// print_liste_field_titre ( $langs->trans ( "Sens" ), "liste.php", "bk.sens" );
print_liste_field_titre ( $langs->trans ( "Codejournal" ), "liste.php", "bk.code_journal" );
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
// print_liste_field_titre("Amount", "liste.php", "bk.montant" );
// print_liste_field_titre("Sens", "liste.php", "bk.sens" );
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
print '<td></td>';
print '<td></td>';
print "</tr>\n";

View File

@ -200,17 +200,17 @@ llxHeader ( '', 'Compta - Grand Livre' );
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td></td>';
print_liste_field_titre ( $langs->trans ( "Doctype" ), "liste.php", "bk.doc_type" );
print_liste_field_titre ( $langs->trans ( "Docdate" ), "liste.php", "bk.doc_date" );
print_liste_field_titre ( $langs->trans ( "Docref" ), "liste.php", "bk.doc_ref" );
// print_liste_field_titre ( $langs->trans ( "Numerocompte" ), "liste.php", "bk.numero_compte" );
// print_liste_field_titre ( $langs->trans ( "Code_tiers" ), "liste.php", "bk.code_tiers" );
print_liste_field_titre ( $langs->trans ( "Labelcompte" ), "liste.php", "bk_label_compte" );
print_liste_field_titre ( $langs->trans ( "Debit" ), "liste.php", "bk.debit" );
print_liste_field_titre ( $langs->trans ( "Credit" ), "liste.php", "bk.credit" );
print_liste_field_titre ( $langs->trans ( "Amount" ), "liste.php", "bk.montant" );
print_liste_field_titre ( $langs->trans ( "Sens" ), "liste.php", "bk.sens" );
print_liste_field_titre ( $langs->trans ( "Codejournal" ), "liste.php", "bk.code_journal" );
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
print_liste_field_titre("Amount", "liste.php", "bk.montant" );
print_liste_field_titre("Sens", "liste.php", "bk.sens" );
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
print '<td></td>';
print '<td></td>';
print "</tr>\n";

View File

@ -37,7 +37,7 @@ class AccountancySystem
var $label;
var $account_number;
var $account_parent;
/**
* Constructor
*
@ -46,8 +46,8 @@ class AccountancySystem
function __construct($db) {
$this->db = $db;
}
/**
* Load record in memory
*
@ -55,11 +55,11 @@ class AccountancySystem
* @param string $ref ref
* @return int <0 if KO, Id of record if OK and found
*/
function fetch($rowid = 0, $ref = '')
function fetch($rowid = 0, $ref = '')
{
global $conf;
if ($rowid > 0 || $ref)
if ($rowid > 0 || $ref)
{
$sql = "SELECT a.pcg_version, a.label, a.active";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
@ -69,12 +69,12 @@ class AccountancySystem
} elseif ($ref) {
$sql .= " a.pcg_version = '" . $ref . "'";
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
if ($obj) {
$this->id = $obj->rowid;
$this->rowid = $obj->rowid;
@ -82,7 +82,7 @@ class AccountancySystem
$this->ref = $obj->pcg_version;
$this->label = $obj->label;
$this->active = $obj->active;
return $this->id;
} else {
return 0;
@ -94,8 +94,8 @@ class AccountancySystem
}
return - 1;
}
/**
* Insert accountancy system name into database
*
@ -104,16 +104,16 @@ class AccountancySystem
*/
function create($user) {
$now = dol_now();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
$sql .= " (date_creation, fk_user_author, numero, label)";
$sql .= " VALUES (" . $this->db->idate($now) . "," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_system");
if ($id > 0) {
$this->rowid = $id;
$result = $this->rowid;
@ -127,7 +127,7 @@ class AccountancySystem
$this->error = "AccountancySystem::Create Erreur $result";
dol_syslog($this->error, LOG_ERR);
}
return $result;
}
}

View File

@ -280,17 +280,17 @@ if ($result) {
print "</td></tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
$clickpicto=$form->showCheckAddButtons();
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"');
print "</tr>\n";

View File

@ -295,16 +295,16 @@ if ($result) {
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"');
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"');
$checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');

View File

@ -251,14 +251,14 @@ if ($result) {
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre('');
$checkpicto=$form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');

View File

@ -277,15 +277,15 @@ if ($result) {
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"', $sortfield, $sortorder);
$checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');

View File

@ -278,18 +278,18 @@ if ($result) {
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
$checkpicto=$form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
print "</tr>\n";

View File

@ -294,17 +294,17 @@ if ($result) {
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"');
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"');
$checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');

View File

@ -594,8 +594,8 @@ if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titr
if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.town']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder);
@ -611,7 +611,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}

View File

@ -155,7 +155,7 @@ if ($result)
$num = $db->num_rows($result);
$arrayofselected=is_array($toselect)?$toselect:array();
$i = 0;
$title=$langs->trans("ListOfSubscriptions");
@ -171,7 +171,7 @@ if ($result)
if ($search_acount) $param.="&search_account=".$search_account;
if ($search_amount) $param.="&search_amount=".$search_amount;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
@ -181,7 +181,7 @@ if ($result)
if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -191,7 +191,7 @@ if ($result)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
if ($sall)
@ -200,11 +200,11 @@ if ($result)
}
$moreforfilter = '';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@ -237,33 +237,33 @@ if ($result)
print '<td align="right" class="liste_titre">';
print '<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'" size="4">';
print '</td>';
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled))
{
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder);
//print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
// Static objects
$subscription=new Subscription($db);
$adherent=new Adherent($db);
@ -286,7 +286,7 @@ if ($result)
$adherent->login=$obj->login;
$adherent->photo=$obj->photo;
print '<tr class="oddeven">';
@ -329,7 +329,7 @@ if ($result)
// Price
print '<td align="right">'.price($obj->subscription).'</td>';
print '<td></td>';
print "</tr>";
@ -338,7 +338,7 @@ if ($result)
}
// Total
print '<tr class="liste_total">';
print "<td>".$langs->trans("Total")."</td>\n";
print "<td align=\"right\">&nbsp;</td>\n";

View File

@ -508,13 +508,13 @@ if ($rowid > 0)
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Nature"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print_liste_field_titre( $langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Nature",$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("EndSubscription",$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Action",$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print "</tr>\n";
while ($i < $num && $i < $conf->liste_limit)

View File

@ -285,7 +285,7 @@ if ($mode != 'focus')
print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder);
}
// Entity
if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder);
if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity",$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder);
// Actions
print '<td align="center"></td>';
print "</tr>\n";

View File

@ -88,7 +88,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0);
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,35,36,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,);
// Name of SQL tables of dictionaries
$tabname=array();
@ -126,6 +126,8 @@ $tabname[30]= MAIN_DB_PREFIX."c_format_cards";
//$tabname[32]= MAIN_DB_PREFIX."c_accounting_category";
$tabname[33]= MAIN_DB_PREFIX."c_hrm_department";
$tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
$tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat";
$tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range";
// Dictionary labels
$tablib=array();
@ -163,6 +165,8 @@ $tablib[30]= "DictionaryFormatCards";
//$tablib[32]= "DictionaryAccountancyCategory";
$tablib[33]= "DictionaryDepartment";
$tablib[34]= "DictionaryFunction";
$tablib[35]= "DictionaryExpenseTaxCat";
$tablib[36]= "DictionaryExpenseTaxRange";
// Requests to extract data
$tabsql=array();
@ -200,6 +204,8 @@ $tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmar
//$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
$tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
$tabsql[36]= "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
// Criteria to sort dictionaries
$tabsqlsort=array();
@ -237,6 +243,8 @@ $tabsqlsort[30]="code ASC";
//$tabsqlsort[32]="position ASC";
$tabsqlsort[33]="code ASC";
$tabsqlsort[34]="code ASC";
$tabsqlsort[35]="c.label ASC";
$tabsqlsort[36]="r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
@ -272,8 +280,8 @@ $tabfield[29]= "code,label,percent,position";
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfield[31]= "pcg_version,label";
//$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
$tabfield[33]= "code,label";
$tabfield[34]= "code,label";
$tabfield[35]= "label";
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
@ -311,6 +319,8 @@ $tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargi
//$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
$tabfieldvalue[33]= "code,label";
$tabfieldvalue[34]= "code,label";
$tabfieldvalue[35]= "label";
$tabfieldvalue[36]= "range_ik,fk_c_exp_tax_cat";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
@ -348,6 +358,8 @@ $tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmarg
//$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
$tabfieldinsert[33]= "code,label";
$tabfieldinsert[34]= "code,label";
$tabfieldinsert[35]= "label";
$tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
@ -387,6 +399,8 @@ $tabrowid[30]= "";
//$tabrowid[32]= "";
$tabrowid[33]= "rowid";
$tabrowid[34]= "rowid";
$tabrowid[35]= "";
$tabrowid[36]= "";
// Condition to show dictionary in setup page
$tabcond=array();
@ -424,6 +438,8 @@ $tabcond[30]= ! empty($conf->label->enabled);
//$tabcond[32]= ! empty($conf->accounting->enabled);
$tabcond[33]= ! empty($conf->hrm->enabled);
$tabcond[34]= ! empty($conf->hrm->enabled);
$tabcond[35]= ! empty($conf->expensereport->enabled);
$tabcond[36]= ! empty($conf->expensereport->enabled);
// List of help for fields
$tabhelp=array();
@ -461,6 +477,8 @@ $tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->tran
//$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[35]= array();
$tabhelp[36]= array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
@ -498,6 +516,8 @@ $tabfieldcheck[30] = array();
//$tabfieldcheck[32] = array();
$tabfieldcheck[33] = array();
$tabfieldcheck[34] = array();
$tabfieldcheck[35]= array();
$tabfieldcheck[36]= array();
// Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
@ -1065,6 +1085,9 @@ if ($id)
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
if ($fieldlist[$field]=='fk_c_exp_tax_cat'){ $valuetoshow=$langs->trans("CarCategory"); }
if ($id == 2) // Special cas for state page
{
@ -1284,6 +1307,9 @@ if ($id)
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
if ($fieldlist[$field]=='fk_c_exp_tax_cat'){ $valuetoshow=$langs->trans("CarCategory"); }
// Affiche nom du champ
if ($showfield)
@ -1501,6 +1527,26 @@ if ($id)
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
$valuetoshow = length_accountg($valuetoshow);
}
elseif ($fieldlist[$field] == 'fk_tva')
{
foreach ($form->cache_vatrates as $key => $Tab)
{
if ($form->cache_vatrates[$key]['rowid'] == $valuetoshow)
{
$valuetoshow = $form->cache_vatrates[$key]['libtva'];
break;
}
}
}
elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
{
$valuetoshow = getDictvalue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow);
$valuetoshow = $langs->trans($valuetoshow);
}
elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat')
{
$valuetoshow = $langs->trans($valuetoshow);
}
$class='tddict';
if ($fieldlist[$field] == 'note' && $id == 10) $class.=' tdoverflowmax200';
@ -1667,7 +1713,7 @@ $db->close();
*/
function fieldList($fieldlist, $obj='', $tabname='', $context='')
{
global $conf,$langs,$db;
global $conf,$langs,$db,$mysoc;
global $form;
global $region_id;
global $elementList,$sourceList,$localtax_typeList;
@ -1834,6 +1880,24 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
}
print '</td>';
}
elseif ($fieldlist[$field] == 'fk_tva')
{
print '<td>';
print $form->load_tva('fk_tva', $obj->taux, $mysoc, new Societe($db), 0, 0, '', false, -1);
print '</td>';
}
elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
{
print '<td>';
print $form->selectExpenseCategories($obj->fk_c_exp_tax_cat);
print '</td>';
}
elseif ($fieldlist[$field] == 'fk_range')
{
print '<td>';
print $form->selectExpenseRanges($obj->fk_range);
print '</td>';
}
else
{
$classtd=''; $class='';

View File

@ -0,0 +1,188 @@
<?php
/* Copyright (C) 2012 Mikael Carlavan <contact@mika-carl.fr>
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
* Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
*
* 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 2 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/>.
*/
/**
* \file htdocs/admin/expensereport_ik.php
* \ingroup expensereport
* \brief Page to display expense tax ik
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php';
$langs->load('admin');
$langs->load('other');
$langs->load('trips');
$langs->load('errors');
$langs->load('dict');
if (!$user->admin) accessforbidden();
//Init error
$error = false;
$message = false;
$action = GETPOST('action','alpha');
$id = GETPOST('id','int');
$offset = GETPOST('offset','int');
$coef = GETPOST('coef','int');
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
$fk_range = GETPOST('fk_range');
if ($action == 'updateik')
{
$expIk = new ExpenseReportIk($db);
if ($id > 0)
{
$result = $expIk->fetch($id);
if ($result < 0) dol_print_error('', $expIk->error, $expIk->errors);
}
$expIk->setValues($_POST);
$result = $expIk->create($user);
if ($result > 0) setEventMessages('SetupSaved', null, 'mesgs');
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
elseif ($action == 'delete') // TODO add confirm
{
$expIk = new ExpenseReportIk($db);
if ($id > 0)
{
$result = $expIk->fetch($id);
if ($result < 0) dol_print_error('', $expIk->error, $expIk->errors);
$expIk->delete($user);
}
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
$rangesbycateg = ExpenseReportIk::getAllRanges();
/*
* View
*/
llxHeader();
$form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ExpenseReportsIkSetup"),$linkback,'title_setup');
$head=expensereport_admin_prepare_head();
dol_fiche_head($head, 'expenseik', $langs->trans("ExpenseReportsIk"), -1, 'trip');
echo $langs->trans('ExpenseReportIkDesc');
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
if ($action == 'edit')
{
echo '<input type="hidden" name="id" value="'.$id.'" />';
echo '<input type="hidden" name="fk_c_exp_tax_cat" value="'.$fk_c_exp_tax_cat.'" />';
echo '<input type="hidden" name="fk_range" value="'.$fk_range.'" />';
echo '<input type="hidden" name="action" value="updateik" />';
}
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
echo '<table class="noborder" width="100%">';
foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab)
{
$title = ($Tab['active'] == 1) ? $langs->trans($Tab['label']) : $form->textwithpicto($langs->trans($Tab['label']), $langs->trans('expenseReportCatDisabled'), 1, 'help', '', 0, 3);
echo '<tr class="liste_titre">';
echo '<td>'.$title.'</td>';
echo '<td>'.$langs->trans('expenseReportOffset').'</td>';
echo '<td>'.$langs->trans('expenseReportCoef').'</td>';
echo '<td>'.$langs->trans('expenseReportTotalForFive').'</td>';
echo '<td>&nbsp;</td>';
echo '</tr>';
if ($Tab['active'] == 0) continue;
$tranche=1;
$var = true;
foreach ($Tab['ranges'] as $k => $range)
{
if (isset($Tab['ranges'][$k+1])) $label = $langs->trans('expenseReportRangeFromTo', $range->range_ik, ($Tab['ranges'][$k+1]->range_ik-1));
else $label = $langs->trans('expenseReportRangeMoreThan', $range->range_ik);
if ($range->range_active == 0) $label = $form->textwithpicto($label, $langs->trans('expenseReportRangeDisabled'), 1, 'help', '', 0, 3);
echo '<tr '.$bc[$var].'>';
// Label
echo '<td width="20%"><b>['.$langs->trans('RangeNum', $tranche++).']</b> - '.$label.'</td>';
// Offset
echo '<td width="20%">';
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" name="offset" value="'.$range->ik->offset.'" />';
else echo $range->ik->offset;
echo '</td>';
// Coef
echo '<td width="20%">';
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" name="coef" value="'.$range->ik->coef.'" />';
else echo ($range->ik->id > 0 ? $range->ik->coef : $langs->trans('expenseReportCoefUndefined'));
echo '</td>';
// Total for one
echo '<td width="30%">'.$langs->trans('expenseReportPrintExample', price($range->ik->offset + 5 * $range->ik->coef)).'</td>';
// Action
echo '<td align="right">';
if ($range->range_active == 1)
{
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat)
{
echo '<input id="" class="button" name="save" value="'.$langs->trans('Save').'" type="submit" />';
echo '<input class="button" value="'.$langs->trans('Cancel').'" onclick="javascript:history.go(-1)" type="button" />';
}
else
{
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$range->ik->id.'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.'&fk_range='.$range->rowid.'">'.img_edit().'</a>';
if (!empty($range->ik->id)) echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$range->ik->id.'">'.img_delete().'</a>';
// TODO add delete link
}
}
echo '</td>';
echo '</tr>';
$var=!$var;
}
}
echo '</table>';
echo '</form>';
dol_fiche_end();
llxFooter();
$db->close();

View File

@ -0,0 +1,366 @@
<?php
/* Copyright (C) 2012 Mikael Carlavan <contact@mika-carl.fr>
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
* Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
*
* 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 2 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/>.
*/
/**
* \file htdocs/admin/expensereport_ik.php
* \ingroup expensereport
* \brief Page to display expense tax ik
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.php';
$langs->load('admin');
$langs->load('other');
$langs->load('trips');
$langs->load('errors');
$langs->load('dict');
if (!$user->admin) accessforbidden();
//Init error
$error = false;
$message = false;
$action = GETPOST('action','alpha');
$id = GETPOST('id','int');
$apply_to = GETPOST('apply_to');
$fk_user = GETPOST('fk_user');
$fk_usergroup = GETPOST('fk_usergroup');
$fk_c_type_fees = GETPOST('fk_c_type_fees');
$code_expense_rules_type = GETPOST('code_expense_rules_type');
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$amount = GETPOST('amount');
$restrictive = GETPOST('restrictive');
$object = new ExpenseReportRule($db);
if (!empty($id))
{
$result = $object->fetch($id);
if ($result < 0) dol_print_error('', $object->error, $object->errors);
}
// TODO do action
if ($action == 'save')
{
$error = 0;
// check parameters
if (empty($apply_to)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportApplyTo")), null, 'errors');
}
if (empty($fk_c_type_fees)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDomain")), null, 'errors');
}
if (empty($code_expense_rules_type)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitOn")), null, 'errors');
}
if (empty($dates)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateStart")), null, 'errors');
}
if (empty($datee)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateEnd")), null, 'errors');
}
if (empty($amount)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitAmount")), null, 'errors');
}
if (empty($error))
{
$object->setValues($_POST);
if($apply_to=='U'){
$object->fk_user=$fk_user;
$object->fk_usergroup=0;
$object->is_for_all=0;
}elseif($apply_to=='G'){
$object->fk_usergroup=$fk_usergroup;
$object->fk_user=0;
$object->is_for_all=0;
}elseif($apply_to=='A'){
$object->is_for_all=1;
$object->fk_user=0;
$object->fk_usergroup=0;
}
$object->dates = $dates;
$object->datee = $datee;
$object->entity = $conf->entity;
$res = $object->create($user);
if ($res > 0) setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
else dol_print_error($object->db);
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
}
elseif ($action == 'delete')
{
// TODO add confirm
$res = $object->delete($user);
if ($res < 0) dol_print_error($object->db);
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
$rules = ExpenseReportRule::getAllRule();
$tab_apply = array('A' => $langs->trans('All'), 'G' => $langs->trans('Group'), 'U' => $langs->trans('User'));
$tab_rules_type = array('EX_DAY' => $langs->trans('Day'), 'EX_MON' => $langs->trans('Month'), 'EX_YEA' => $langs->trans('Year'), 'EX_EXP' => $langs->trans('OnExpense'));
/*
* View
*/
llxHeader();
$form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ExpenseReportsRulesSetup"),$linkback,'title_setup');
$head=expensereport_admin_prepare_head();
dol_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRules"), -1, 'trip');
echo $langs->trans('ExpenseReportRulesDesc');
if ($action != 'edit')
{
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
echo '<input type="hidden" name="action" value="save" />';
echo '<table class="noborder" width="100%">';
echo '<tr class="liste_titre">';
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDomain').'</th>';
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
echo '<th>&nbsp;</th>';
echo '</tr>';
$var=true;
echo '<tr '.$bc[$var].'>';
echo '<td>';
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, '', 0).'</div>';
echo '<div id="user" class="float">'.$form->select_dolusers('', 'fk_user').'</div>';
echo '<div id="group" class="float">'.$form->select_dolgroups('', 'fk_usergroup').'</div>';
echo '</td>';
echo '<td>'.$form->selectExpense('', 'fk_c_type_fees', 0, 1, 1).'</td>';
echo '<td>'.$form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0).'</td>';
echo '<td>'.$form->select_date(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0, 1).'</td>';
echo '<td>'.$form->select_date(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0, 1).'</td>';
echo '<td><input type="text" value="" name="amount" class="amount" />'.$conf->currency.'</td>';
echo '<td>'.$form->selectyesno('restrictive', 0, 1).'</td>';
echo '<td align="right"><input type="submit" class="button" value="'.$langs->trans('Add').'" /></td>';
echo '</tr>';
echo '</table>';
echo '</form>';
}
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
if ($action == 'edit')
{
echo '<input type="hidden" name="id" value="'.$object->id.'" />';
echo '<input type="hidden" name="action" value="save" />';
}
echo '<table class="noborder" width="100%">';
echo '<tr class="liste_titre">';
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDomain').'</th>';
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
echo '<th>&nbsp;</th>';
echo '</tr>';
$var=true;
foreach ($rules as $rule)
{
echo '<tr '.$bc[$var].'>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
$selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U');
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, $selected, 0).'</div>';
echo '<div id="user" class="float">'.$form->select_dolusers($object->fk_user, 'fk_user').'</div>';
echo '<div id="group" class="float">'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'</div>';
}
else
{
if ($rule->is_for_all > 0) echo $tab_apply['A'];
elseif ($rule->fk_usergroup > 0) echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
elseif ($rule->fk_user > 0) echo $tab_apply['U'].' ('.$rule->getUserName().')';
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
}
else
{
if ($rule->fk_c_type_fees == -1) echo $langs->trans('AllExpenseReport');
else
{
$key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
if ($key != $langs->trans($key)) echo $langs->trans($key);
else echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code'
}
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
}
else
{
echo $tab_rules_type[$rule->code_expense_rules_type];
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo $form->select_date(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0, 1);
}
else
{
echo dol_print_date($rule->dates, 'day');
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo $form->select_date(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0, 1);
}
else
{
echo dol_print_date($rule->datee, 'day');
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo '<input type="text" value="'.price2num($object->amount).'" name="amount" class="amount" />'.$conf->currency;
}
else
{
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo $form->selectyesno('restrictive', $object->restrictive, 1);
}
else
{
echo yn($rule->restrictive, 1, 1);
}
echo '</td>';
echo '<td>';
if ($object->id != $rule->id)
{
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$rule->id.'">'.img_edit().'</a>&nbsp;';
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$rule->id.'">'.img_delete().'</a>';
}
else
{
echo '<input type="submit" class="button" value="'.$langs->trans('Update').'" />&nbsp;';
echo '<a href="'.$_SERVER['PHP_SELF'].'" class="button">'.$langs->trans('Cancel').'</a>';
}
echo '</td>';
echo '</tr>';
$var=!$var;
}
echo '</table>';
echo '</form>';
echo '<script type="text/javascript"> $(function() {
$("#apply_to").change(function() {
var value = $(this).val();
if (value == "A") {
$("#group").hide(); $("#user").hide();
} else if (value == "U") {
$("#user").show();
$("#group").hide();
} else if (value == "G") {
$("#group").show();
$("#user").hide();
}
});
$("#apply_to").change();
}); </script>';
dol_fiche_end();
llxFooter();
$db->close();

View File

@ -296,7 +296,7 @@ if ($conf->use_javascript_ajax)
//puis tous les elements enfants
$sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.module";
$sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.position, m.module";
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
$sql.= " WHERE menu_handler = '".$db->escape($menu_handler_to_search)."'";
$sql.= " AND entity = ".$conf->entity;
@ -323,6 +323,7 @@ if ($conf->use_javascript_ajax)
'leftmenu'=>$menu['leftmenu'],
'fk_mainmenu'=>$menu['fk_mainmenu'],
'fk_leftmenu'=>$menu['fk_leftmenu'],
'position'=>$menu['position'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.
'<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>'.
'</td><td align="right">'.
@ -344,10 +345,11 @@ if ($conf->use_javascript_ajax)
global $tree_recur_alreadyadded; // This var was def into tree_recur
// Appelle de la fonction recursive (ammorce)
// avec recherche depuis la racine.
//var_dump($data);
tree_recur($data, $data[0], 0, 'iddivjstree'); // $data[0] is virtual record 'racine'
// Appelle de la fonction recursive (ammorce) avec recherche depuis la racine.
//tree_recur($data, $data[0], 0, 'iddivjstree', 0, 1); // use this to get info on name and foreign keys of menu entry
tree_recur($data, $data[0], 0, 'iddivjstree', 0, 0); // $data[0] is virtual record 'racine'
print '</td>';
@ -376,7 +378,6 @@ if ($conf->use_javascript_ajax)
print '<tr>';
print '<td colspan="2">';
foreach($remainingdata as $datar)
{
$father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>'');

View File

@ -269,7 +269,7 @@ if ($objMod->isCoreOrExternalModule() == 'external')
$modulename=$objMod->getName();
$moduledesc=$objMod->getDesc();
$moduleauthor=$objMod->getPublisher();
$moduledir=strtolower(preg_replace('/^mod/i','',get_class($objMod)));
print '<div class="centpercent">';
@ -449,11 +449,28 @@ if ($mode == 'feature')
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
$moreinfoontriggerfile='';
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{
$text.=$langs->trans("Yes");
$yesno='Yes';
}
else $text.=$langs->trans("No");
else
{
$yesno='No';
}
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
$interfaces = new Interfaces($db);
$triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() == 'external')?'/'.$moduledir:'').'/core/triggers'));
foreach($triggers as $triggercursor)
{
if ($triggercursor['module'] == $moduledir)
{
$yesno='Yes';
$moreinfoontriggerfile=' ('.$triggercursor['relpath'].')';
}
}
$text.=$langs->trans($yesno).$moreinfoontriggerfile;
$text.='<br>';

View File

@ -260,11 +260,11 @@ if ($result)
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Code",$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("IP",$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("User",$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Description",$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";

View File

@ -128,12 +128,12 @@ if ($savehandler == 'files')
{
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"login","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("SessionId"),$_SERVER["PHP_SELF"],"id","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateModification"),$_SERVER["PHP_SELF"],"datem","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Age"),$_SERVER["PHP_SELF"],"age","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Raw"),$_SERVER["PHP_SELF"],"raw","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"login","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("SessionId",$_SERVER["PHP_SELF"],"id","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"datec","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DateModification",$_SERVER["PHP_SELF"],"datem","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Age",$_SERVER["PHP_SELF"],"age","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Raw",$_SERVER["PHP_SELF"],"raw","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
@ -141,7 +141,7 @@ if ($savehandler == 'files')
foreach ($listofsessions as $key => $sessionentry)
{
print '<tr class="oddeven">';

View File

@ -235,10 +235,10 @@ if ($mode == 'overwrite')
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("NewTranslationStringToShow"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre("Key",$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre("NewTranslationStringToShow",$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
print '<td align="center"></td>';
print "</tr>\n";
@ -393,10 +393,10 @@ if ($mode == 'searchkey')
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).'</td>';
print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CurrentTranslationString"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).'</td>';
print_liste_field_titre("Key",$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre("CurrentTranslationString",$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity",$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
print '<td align="center"></td>';
print "</tr>\n";

View File

@ -238,6 +238,7 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json'
{
$classfile = str_replace('_', '', $module);
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
if ($module == 'supplierorders') $classfile = 'supplier_orders';
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
$classname=ucwords($module);

View File

@ -101,19 +101,19 @@ if ($resql)
if ($optioncss != '') $param ='&optioncss='.$optioncss;
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print "<tr class=\"liste_titre\">";
//print "<td>&nbsp;</td>";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Link"),'','');
print_liste_field_titre($langs->trans("Target"),'','','','','align="center"');
print_liste_field_titre($langs->trans("Owner"),$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Position"),$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Link",'','');
print_liste_field_titre("Target",'','','','','align="center"');
print_liste_field_titre("Owner",$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Position",$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
@ -122,7 +122,7 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
// Id
@ -209,7 +209,7 @@ if ($resql)
}
print "</table>";
print '</div>';
$db->free($resql);
}
else

View File

@ -38,11 +38,8 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
if (! empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("companies");
@ -585,6 +582,8 @@ if ($action == 'mupdate')
* View
*/
$formproject=new FormProjets($db);
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
@ -786,8 +785,6 @@ if ($action == 'create')
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
// Projet associe
$langs->load("projects");
@ -1133,8 +1130,6 @@ if ($id > 0)
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
$langs->load("projects");
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td>';

View File

@ -1194,7 +1194,7 @@ class ActionComm extends CommonObject
{
$libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':'');
}
$result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend;
$result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'class="valigntextbottom"':'class="classfortooltip valigntextbottom"'), 0, 0, $notooltip?0:1).$linkend;
}
if ($withpicto==1) $result.=' ';
$result.=$linkstart.$libelleshort.$linkend;
@ -1498,5 +1498,22 @@ class ActionComm extends CommonObject
return $this->datep && ($this->datep < ($now - $conf->agenda->warning_delay));
}
/**
* Send reminders by emails
* CAN BE A CRON TASK
*
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
*/
public function sendEmailsReminder()
{
global $conf, $langs;
dol_syslog(__METHOD__, LOG_DEBUG);
return 0;
}
}

View File

@ -394,17 +394,17 @@ if ($resql)
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre($langs->trans("LinkedObject"),$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ActionsOwnedByShort"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("");
print "</tr>\n";

View File

@ -30,15 +30,17 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
$filter = GETPOST("filter",'',3);
$filter = GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
@ -55,7 +57,7 @@ $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page","int");
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$offset = $limit * $page;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datec";
@ -82,9 +84,9 @@ $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3);
$status=GETPOST("status");
$type=GETPOST("type");
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
$status=GETPOST("status",'alpha');
$type=GETPOST("type",'alpha');
$maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('actioncode','array'))
{
@ -93,22 +95,22 @@ if (GETPOST('actioncode','array'))
}
else
{
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode","alpha")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
if ($dateselect > 0)
{
$day=GETPOST('dateselectday');
$month=GETPOST('dateselectmonth');
$year=GETPOST('dateselectyear');
$day=GETPOST('dateselectday','int');
$month=GETPOST('dateselectmonth','int');
$year=GETPOST('dateselectyear','int');
}
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
$tmparray=explode('-',$tmp);
$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
$begin_h = GETPOST('begin_h','int')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
$end_h = GETPOST('end_h','int')?GETPOST('end_h','int'):($tmparray[1] != '' ? $tmparray[1] : 18);
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
if ($end_h < 1 || $end_h > 24) $end_h = 18;
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
@ -124,13 +126,13 @@ if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $ac
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
$action='show_month'; $day='';
} // View by month
if (GETPOST('viewweek') || $action == 'show_week') {
if (GETPOST('viewweek','alpha') || $action == 'show_week') {
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
} // View by week
if (GETPOST('viewday') || $action == 'show_day') {
if (GETPOST('viewday','alpha') || $action == 'show_day') {
$action='show_day'; $day=($day?$day:date("d"));
} // View by day
if (GETPOST('viewyear') || $action == 'show_year') {
if (GETPOST('viewyear','alpha') || $action == 'show_year') {
$action='show_year';
} // View by year
@ -161,12 +163,12 @@ if ($action =='delete_action')
* View
*/
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&oacute;dulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
$form=new Form($db);
$companystatic=new Societe($db);
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&oacute;dulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
$now=dol_now();
$nowarray=dol_getdate($now);
$nowyear=$nowarray['year'];
@ -354,7 +356,7 @@ $sql.= ' a.datep2,';
$sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
$sql.= ' ca.code, ca.color';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
@ -456,11 +458,14 @@ if ($resql)
continue;
}
$datep=$db->jdate($obj->datep);
$datep2=$db->jdate($obj->datep2);
// Create a new object action
$event=new ActionComm($db);
$event->id=$obj->id;
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
$event->datef=$db->jdate($obj->datep2);
$event->datep=$datep; // datep and datef are GMT date
$event->datef=$datep2;
$event->type_code=$obj->code;
$event->type_color=$obj->color;
//$event->libelle=$obj->label; // deprecated
@ -469,12 +474,13 @@ if ($resql)
//$event->author->id=$obj->fk_user_author; // user id of creator
$event->authorid=$obj->fk_user_author; // user id of creator
$event->userownerid=$obj->fk_user_action; // user id of owner
$event->fetch_userassigned(); // This load $event->userassigned
$event->priority=$obj->priority;
$event->fulldayevent=$obj->fulldayevent;
$event->location=$obj->location;
$event->transparency=$obj->transparency;
$event->fk_project=$obj->fk_project;
$event->socid=$obj->fk_soc;
$event->contactid=$obj->fk_contact;
//$event->societe->id=$obj->fk_soc; // deprecated
@ -487,15 +493,15 @@ if ($resql)
// They are date start and end of action but modified to not be outside calendar view.
if ($event->percentage <= 0)
{
$event->date_start_in_calendar=$event->datep;
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
else $event->date_end_in_calendar=$event->datep;
$event->date_start_in_calendar=$datep;
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
else $event->date_end_in_calendar=$datep;
}
else
{
$event->date_start_in_calendar=$event->datep;
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
else $event->date_end_in_calendar=$event->datep;
{
$event->date_start_in_calendar=$datep;
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
else $event->date_end_in_calendar=$datep;
}
// Define ponctual property
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
@ -508,10 +514,14 @@ if ($resql)
$event->date_start_in_calendar >= $lastdaytoshow)
{
// This record is out of visible range
unset($event);
}
else
{
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
//print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'<br>'."\n";
$event->fetch_userassigned(); // This load $event->userassigned
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
// Add an entry in actionarray for each day
@ -881,11 +891,37 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
}
$cases1[$h][$event->id]['string'].=' - '.$event->label;
$cases1[$h][$event->id]['typecode']=$event->type_code;
if ($event->socid)
{
//$cases1[$h][$event->id]['string'].='xxx';
}
$cases1[$h][$event->id]['color']=$color;
if ($event->fk_project > 0)
{
if (empty($cache_project[$event->fk_project]))
{
$tmpproj=new Project($db);
$tmpproj->fetch($event->fk_project);
$cache_project[$event->fk_project]=$tmpproj;
}
$cases1[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
}
if ($event->socid > 0)
{
if (empty($cache_thirdparty[$event->socid]))
{
$tmpthirdparty=new Societe($db);
$tmpthirdparty->fetch($event->socid);
$cache_thirdparty[$event->socid]=$tmpthirdparty;
}
$cases1[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
}
if ($event->contactid > 0)
{
if (empty($cache_contact[$event->contactid]))
{
$tmpcontact=new Contact($db);
$tmpcontact->fetch($event->contactid);
$cache_contact[$event->contactid]=$tmpcontact;
}
$cases1[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
}
}
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
{
@ -901,11 +937,37 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
}
$cases2[$h][$event->id]['string'].=' - '.$event->label;
$cases2[$h][$event->id]['typecode']=$event->type_code;
if ($event->socid)
{
//$cases2[$h][$event->id]['string'].='xxx';
}
$cases2[$h][$event->id]['color']=$color;
if ($event->fk_project > 0)
{
if (empty($cache_project[$event->fk_project]))
{
$tmpproj=new Project($db);
$tmpproj->fetch($event->fk_project);
$cache_project[$event->fk_project]=$tmpproj;
}
$cases2[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
}
if ($event->socid > 0)
{
if (empty($cache_thirdparty[$event->socid]))
{
$tmpthirdparty=new Societe($db);
$tmpthirdparty->fetch($event->socid);
$cache_thirdparty[$event->socid]=$tmpthirdparty;
}
$cases2[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
}
if ($event->contactid > 0)
{
if (empty($cache_contact[$event->contactid]))
{
$tmpcontact=new Contact($db);
$tmpcontact->fetch($event->contactid);
$cache_contact[$event->contactid]=$tmpcontact;
}
$cases2[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
}
}
}
else
@ -928,6 +990,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
}
}
// Now output $casesX
for ($h = $begin_h; $h < $end_h; $h++)
{
$color1='';$color2='';

View File

@ -30,15 +30,17 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
$filter = GETPOST("filter",'',3);
$filter = GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
@ -55,7 +57,7 @@ $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page","int");
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$offset = $limit * $page;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datec";
@ -82,9 +84,9 @@ $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3);
$status=GETPOST("status");
$type=GETPOST("type");
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
$status=GETPOST("status",'alpha');
$type=GETPOST("type",'alpha');
$maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('actioncode','array'))
{
@ -93,29 +95,30 @@ if (GETPOST('actioncode','array'))
}
else
{
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode","alpha")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
if ($dateselect > 0)
{
$day=GETPOST('dateselectday');
$month=GETPOST('dateselectmonth');
$year=GETPOST('dateselectyear');
$day=GETPOST('dateselectday','int');
$month=GETPOST('dateselectmonth','int');
$year=GETPOST('dateselectyear','int');
}
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
$tmparray=explode('-',$tmp);
$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
$begin_h = GETPOST('begin_h','int')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
$end_h = GETPOST('end_h','int')?GETPOST('end_h','int'):($tmparray[1] != '' ? $tmparray[1] : 18);
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
if ($end_h < 1 || $end_h > 24) $end_h = 18;
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)?'1-5':$conf->global->MAIN_DEFAULT_WORKING_DAYS;
$tmparray=explode('-',$tmp);
$begin_d = GETPOST('begin_d')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tmparray[0] : 1);
$end_d = GETPOST('end_d')?GETPOST('end_d'):($tmparray[1] != '' ? $tmparray[1] : 5);
$begin_d = GETPOST('begin_d','int')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tmparray[0] : 1);
$end_d = GETPOST('end_d','int')?GETPOST('end_d','int'):($tmparray[1] != '' ? $tmparray[1] : 5);
if ($begin_d < 1 || $begin_d > 7) $begin_d = 1;
if ($end_d < 1 || $end_d > 7) $end_d = 7;
if ($end_d < $begin_d) $end_d = $begin_d + 1;
@ -123,13 +126,13 @@ if ($end_d < $begin_d) $end_d = $begin_d + 1;
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
if (GETPOST('viewcal','alpha') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
$action='show_month'; $day='';
} // View by month
if (GETPOST('viewweek') || $action == 'show_week') {
if (GETPOST('viewweek','alpha') || $action == 'show_week') {
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
} // View by week
if (GETPOST('viewday') || $action == 'show_day') {
if (GETPOST('viewday','alpha') || $action == 'show_day') {
$action='show_day'; $day=($day?$day:date("d"));
} // View by day
@ -160,12 +163,12 @@ if ($action =='delete_action')
* View
*/
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&oacute;dulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
$form=new Form($db);
$companystatic=new Societe($db);
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&oacute;dulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
$now=dol_now();
$nowarray=dol_getdate($now);
$nowyear=$nowarray['year'];
@ -361,7 +364,7 @@ $sql.= ' a.datep2,';
$sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
$sql.= ' ca.code, ca.color';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
@ -418,14 +421,14 @@ else
{
// To limit array
$sql.= " AND (";
$sql.= " (a.datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'"; // Start 7 days before
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')"; // End 7 days after + 3 to go from 28 to 31
$sql.= " (a.datep BETWEEN '".$db->idate($firstdaytoshow-(60*60*24*2))."'"; // Start 2 day before $firstdaytoshow
$sql.= " AND '".$db->idate($lastdaytoshow+(60*60*24*2))."')"; // End 2 day after $lastdaytoshow
$sql.= " OR ";
$sql.= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
$sql.= " (a.datep2 BETWEEN '".$db->idate($firstdaytoshow-(60*60*24*2))."'";
$sql.= " AND '".$db->idate($lastdaytoshow+(60*60*24*2))."')";
$sql.= " OR ";
$sql.= " (a.datep < '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
$sql.= " AND a.datep2 > '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
$sql.= " (a.datep < '".$db->idate($firstdaytoshow-(60*60*24*2))."'";
$sql.= " AND a.datep2 > '".$db->idate($lastdaytoshow+(60*60*24*2))."')";
$sql.= ')';
}
if ($type) $sql.= " AND ca.id = ".$type;
@ -444,13 +447,14 @@ if ($filtert > 0 || $usergroup > 0)
}
// Sort on date
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
//print $sql;
//print $sql;exit;
dol_syslog("comm/action/peruser.php", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i=0;
while ($i < $num)
{
@ -463,11 +467,14 @@ if ($resql)
continue;
}
$datep=$db->jdate($obj->datep);
$datep2=$db->jdate($obj->datep2);
// Create a new object action
$event=new ActionComm($db);
$event->id=$obj->id;
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
$event->datef=$db->jdate($obj->datep2);
$event->datep=$datep; // datep and datef are GMT date
$event->datef=$datep2;
$event->type_code=$obj->code;
$event->type_color=$obj->color;
//$event->libelle=$obj->label; // deprecated
@ -476,12 +483,13 @@ if ($resql)
//$event->author->id=$obj->fk_user_author; // user id of creator
$event->authorid=$obj->fk_user_author; // user id of creator
$event->userownerid=$obj->fk_user_action; // user id of owner
$event->fetch_userassigned(); // This load $event->userassigned
$event->priority=$obj->priority;
$event->fulldayevent=$obj->fulldayevent;
$event->location=$obj->location;
$event->transparency=$obj->transparency;
$event->fk_project=$obj->fk_project;
$event->socid=$obj->fk_soc;
$event->contactid=$obj->fk_contact;
//$event->societe->id=$obj->fk_soc; // deprecated
@ -494,15 +502,15 @@ if ($resql)
// They are date start and end of action but modified to not be outside calendar view.
if ($event->percentage <= 0)
{
$event->date_start_in_calendar=$event->datep;
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
else $event->date_end_in_calendar=$event->datep;
$event->date_start_in_calendar=$datep;
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
else $event->date_end_in_calendar=$datep;
}
else
{
$event->date_start_in_calendar=$event->datep;
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
else $event->date_end_in_calendar=$event->datep;
$event->date_start_in_calendar=$datep;
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
else $event->date_end_in_calendar=$datep;
}
// Define ponctual property
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
@ -515,10 +523,14 @@ if ($resql)
$event->date_start_in_calendar >= $lastdaytoshow)
{
// This record is out of visible range
unset($event);
}
else
{
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
//print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'<br>'."\n";
$event->fetch_userassigned(); // This load $event->userassigned
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
// Add an entry in actionarray for each day
@ -548,6 +560,7 @@ if ($resql)
$i++;
}
$db->free($resql);
}
else
{
@ -865,11 +878,12 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
global $theme_datacolor; // Array with a list of different we can use (come from theme)
global $cachethirdparties, $cachecontacts, $colorindexused;
global $begin_h, $end_h;
global $cache_project, $cache_thirdparty, $cache_contact;
$cases1 = array(); // Color first half hour
$cases2 = array(); // Color second half hour
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
$curtime = dol_mktime(0, 0, 0, $month, $day, $year, false, 0);
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
@ -980,13 +994,39 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
else $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
}
$cases1[$h][$event->id]['string'].=' - '.$event->label;
if ($event->label) $cases1[$h][$event->id]['string'].=' - '.$event->label;
$cases1[$h][$event->id]['typecode']=$event->type_code;
if ($event->socid)
{
//$cases1[$h][$event->id]['string'].='xxx';
}
$cases1[$h][$event->id]['color']=$color;
if ($event->fk_project > 0)
{
if (empty($cache_project[$event->fk_project]))
{
$tmpproj=new Project($db);
$tmpproj->fetch($event->fk_project);
$cache_project[$event->fk_project]=$tmpproj;
}
$cases1[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
}
if ($event->socid > 0)
{
if (empty($cache_thirdparty[$event->socid]))
{
$tmpthirdparty=new Societe($db);
$tmpthirdparty->fetch($event->socid);
$cache_thirdparty[$event->socid]=$tmpthirdparty;
}
$cases1[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
}
if ($event->contactid > 0)
{
if (empty($cache_contact[$event->contactid]))
{
$tmpcontact=new Contact($db);
$tmpcontact->fetch($event->contactid);
$cache_contact[$event->contactid]=$tmpcontact;
}
$cases1[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
}
}
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
{
@ -1000,13 +1040,39 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
else $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
}
$cases2[$h][$event->id]['string'].=' - '.$event->label;
if ($event->label) $cases2[$h][$event->id]['string'].=' - '.$event->label;
$cases2[$h][$event->id]['typecode']=$event->type_code;
if ($event->socid)
{
//$cases2[$h][$event->id]['string'].='xxx';
}
$cases2[$h][$event->id]['color']=$color;
if ($event->fk_project > 0)
{
if (empty($cache_project[$event->fk_project]))
{
$tmpproj=new Project($db);
$tmpproj->fetch($event->fk_project);
$cache_project[$event->fk_project]=$tmpproj;
}
$cases2[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
}
if ($event->socid > 0)
{
if (empty($cache_thirdparty[$event->socid]))
{
$tmpthirdparty=new Societe($db);
$tmpthirdparty->fetch($event->socid);
$cache_thirdparty[$event->socid]=$tmpthirdparty;
}
$cases2[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
}
if ($event->contactid > 0)
{
if (empty($cache_contact[$event->contactid]))
{
$tmpcontact=new Contact($db);
$tmpcontact->fetch($event->contactid);
$cache_contact[$event->contactid]=$tmpcontact;
}
$cases2[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
}
}
}
else
@ -1029,6 +1095,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
}
}
// Now output $casesX
for ($h = $begin_h; $h < $end_h; $h++)
{
$color1='';$color2='';

View File

@ -126,14 +126,14 @@ if ($resql)
print_barre_liste($title.($label?" (".$label.")":""),$page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,"",$num);
print '<form action="'.$_SERVER["PHP_SELF"].'?type='.GETPOST("type", "alpha").'" method="GET">';
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.name", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Email"));
print_liste_field_titre($langs->trans("Phone"));
print_liste_field_titre("Lastname",$_SERVER["PHP_SELF"],"p.name", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre("Firstname",$_SERVER["PHP_SELF"],"p.firstname", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre("Email");
print_liste_field_titre("Phone");
print "</tr>\n";
print '<tr class="liste_titre">';
@ -150,7 +150,7 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td><a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowContact"),"contact");
@ -168,9 +168,9 @@ if ($resql)
$i++;
}
print "</table>";
print '</form>';
$db->free($resql);
}
else

View File

@ -184,12 +184,12 @@ if ($object->fetch($id) >= 0)
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
@ -221,7 +221,7 @@ if ($object->fetch($id) >= 0)
print "</div>";
dol_fiche_end();
$allowaddtarget=($object->statut == 0);
@ -232,7 +232,7 @@ if ($object->fetch($id) >= 0)
//print '<table class="noborder" width="100%">';
print '<div class="tagtable centpercent liste_titre_bydiv" id="tablelines">';
//print '<tr class="liste_titre">';
print '<div class="tagtr liste_titre">';
//print '<td class="liste_titre">'.$langs->trans("RecipientSelectionModules").'</td>';
@ -245,11 +245,11 @@ if ($object->fetch($id) >= 0)
print '<div class="tagtd">&nbsp;</div>';
//print "</tr>\n";
print '</div>';
clearstatcache();
$var = true;
foreach ($modulesdir as $dir)
{
$modulenames=array();
@ -324,7 +324,7 @@ if ($object->fetch($id) >= 0)
print $obj->getDesc();
//print '</td>';
print '</div>';
try {
$nbofrecipient=$obj->getNbOfRecipients('');
}
@ -345,7 +345,7 @@ if ($object->fetch($id) >= 0)
}
//print '</td>';
print '</div>';
//print '<td align="left">';
print '<div class="tagtd" align="left">';
if ($allowaddtarget)
@ -362,7 +362,7 @@ if ($object->fetch($id) >= 0)
}
//print '</td>';
print '</div>';
//print '<td align="right">';
print '<div class="tagtd" align="right">';
if ($allowaddtarget)
@ -377,10 +377,10 @@ if ($object->fetch($id) >= 0)
}
//print '</td>';
print '</div>';
if ($allowaddtarget) print '</form>';
else print '</div>';
//print "</tr>\n";
// print '</div>'."\n";
}
@ -389,7 +389,7 @@ if ($object->fetch($id) >= 0)
//print '</table>';
print '</div>';
print '<br><br>';
}
@ -412,11 +412,11 @@ if ($object->fetch($id) >= 0)
}
//$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets
$sql .= $db->plimit($limit+1, $offset);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$param = "&amp;id=".$object->id;
@ -436,7 +436,7 @@ if ($object->fetch($id) >= 0)
$cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'<a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition">'.$langs->trans("TargetsReset").'</a>';
}
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','',$limit);
print '</form>';
print "\n<!-- Liste destinataires selectionnes -->\n";
@ -447,12 +447,12 @@ if ($object->fetch($id) >= 0)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="limit" value="'.$limit.'">';
if ($page) $param.= "&amp;page=".$page;
print '<table class="noborder" width="100%">';
// Ligne des champs de filtres
print '<tr class="liste_titre_filter">';
// EMail
@ -475,7 +475,7 @@ if ($object->fetch($id) >= 0)
print '<td class="liste_titre">';
print '&nbsp';
print '</td>';
// Date sending
print '<td class="liste_titre">';
print '&nbsp';
@ -490,13 +490,13 @@ if ($object->fetch($id) >= 0)
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Lastname",$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Firstname",$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("OtherInformations",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Source",$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
// Date sending
if ($object->statut < 2)
{
@ -504,9 +504,9 @@ if ($object->fetch($id) >= 0)
}
else
{
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre("DateSending",$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>';
@ -590,7 +590,7 @@ if ($object->fetch($id) >= 0)
}
else
{
if ($object->statut < 2)
if ($object->statut < 2)
{
print '<tr><td colspan="8" class="opacitymedium">';
print $langs->trans("NoTargetYet");

View File

@ -124,7 +124,7 @@ class AdvanceTargetingMailing extends CommonObject
$sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->fk_mailing."'").",";
$sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
$sql.= " ".$user->id.",";
$sql.= " ".$this->db->idate(dol_now()).",";
$sql.= " '".$this->db->idate(dol_now())."',";
$sql.= " ".$user->id;

View File

@ -109,7 +109,7 @@ if ($result)
$param = "&amp;sall=".urlencode($sall);
if ($filteremail) $param.='&amp;filteremail='.urlencode($filteremail);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -117,9 +117,9 @@ if ($result)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
$moreforfilter = '';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@ -142,24 +142,24 @@ if ($result)
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"m.titre",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"m.date_creat",$param,"",'align="center"',$sortfield,$sortorder);
if (! $filteremail) print_liste_field_titre($langs->trans("NbOfEMails"),$_SERVER["PHP_SELF"],"m.nbemail",$param,"",'align="center"',$sortfield,$sortorder);
if (! $filteremail) print_liste_field_titre($langs->trans("DateLastSend"),$_SERVER["PHP_SELF"],"m.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
else print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"m.titre",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"m.date_creat",$param,"",'align="center"',$sortfield,$sortorder);
if (! $filteremail) print_liste_field_titre("NbOfEMails",$_SERVER["PHP_SELF"],"m.nbemail",$param,"",'align="center"',$sortfield,$sortorder);
if (! $filteremail) print_liste_field_titre("DateLastSend",$_SERVER["PHP_SELF"],"m.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
else print_liste_field_titre("DateSending",$_SERVER["PHP_SELF"],"mc.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
$email=new Mailing($db);
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
print "<tr>";
print '<td><a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$obj->rowid.'">';

View File

@ -24,14 +24,14 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
/**
* API class for orders
*
* @access protected
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
class Proposals extends DolibarrApi
{
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
static $FIELDS = array(
'socid'
@ -56,36 +56,36 @@ class Proposals extends DolibarrApi
* Get properties of a commercial proposal object
*
* Return an array with commercial proposal informations
*
*
* @param int $id ID of commercial proposal
* @return array|mixed data without useless information
*
* @throws RestException
*/
function get($id)
{
{
if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->propal->fetchObjectLinked();
return $this->_cleanObjectDatas($this->propal);
}
/**
* List commercial proposals
*
*
* Get a list of commercial proposals
*
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
@ -96,12 +96,12 @@ class Proposals extends DolibarrApi
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
global $db, $conf;
$obj_ret = array();
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
@ -109,7 +109,7 @@ class Proposals extends DolibarrApi
$sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql.= " FROM ".MAIN_DB_PREFIX."propal as t";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ' WHERE t.entity IN ('.getEntity('propal').')';
@ -122,7 +122,7 @@ class Proposals extends DolibarrApi
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
if ($sqlfilters)
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
@ -131,7 +131,7 @@ class Proposals extends DolibarrApi
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
@ -144,7 +144,7 @@ class Proposals extends DolibarrApi
}
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
@ -195,7 +195,7 @@ class Proposals extends DolibarrApi
if ($this->propal->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating order", array_merge(array($this->propal->error), $this->propal->errors));
}
return $this->propal->id;
}
@ -203,21 +203,21 @@ class Proposals extends DolibarrApi
* Get lines of a commercial proposal
*
* @param int $id Id of commercial proposal
*
*
* @url GET {id}/lines
*
* @return int
*
* @return int
*/
function getLines($id) {
if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@ -233,22 +233,22 @@ class Proposals extends DolibarrApi
* Add a line to given commercial proposal
*
* @param int $id Id of commercial proposal to update
* @param array $request_data Commercial proposal line data
*
* @param array $request_data Commercial proposal line data
*
* @url POST {id}/lines
*
* @return int
*
* @return int
*/
function postLine($id, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@ -294,22 +294,22 @@ class Proposals extends DolibarrApi
*
* @param int $id Id of commercial proposal to update
* @param int $lineid Id of line to update
* @param array $request_data Commercial proposal line data
*
* @param array $request_data Commercial proposal line data
*
* @url PUT {id}/lines/{lineid}
*
* @return object
*
* @return object
*/
function putLine($id, $lineid, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@ -352,21 +352,21 @@ class Proposals extends DolibarrApi
*
* @param int $id Id of commercial proposal to update
* @param int $lineid Id of line to delete
*
*
* @url DELETE {id}/lines/{lineid}
*
* @return int
*
* @return int
*/
function delLine($id, $lineid) {
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@ -382,20 +382,20 @@ class Proposals extends DolibarrApi
* Update commercial proposal general fields (won't touch lines of commercial proposal)
*
* @param int $id Id of commercial proposal to update
* @param array $request_data Datas
*
* @return int
* @param array $request_data Datas
*
* @return int
*/
function put($id, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@ -403,18 +403,18 @@ class Proposals extends DolibarrApi
if ($field == 'id') continue;
$this->propal->$field = $value;
}
if($this->propal->update($id, DolibarrApiAccess::$user,1,'','','update'))
return $this->get($id);
return false;
}
/**
* Delete commercial proposal
*
* @param int $id Commercial proposal ID
*
*
* @return array
*/
function delete($id)
@ -426,32 +426,32 @@ class Proposals extends DolibarrApi
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! $this->propal->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when delete Commercial Proposal : '.$this->propal->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Commercial Proposal deleted'
)
);
}
/**
* Validate a commercial proposal
*
*
* @param int $id Commercial proposal ID
* @param int $notrigger Use {}
*
*
* @url POST {id}/validate
*
*
* @return array
* FIXME An error 403 is returned if the request has an empty body.
* Error message: "Forbidden: Content type `text/plain` is not supported."
@ -469,11 +469,11 @@ class Proposals extends DolibarrApi
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->propal->valid(DolibarrApiAccess::$user, $notrigger);
if ($result == 0) {
throw new RestException(500, 'Error nothing done. May be object is already validated');
@ -481,30 +481,30 @@ class Proposals extends DolibarrApi
if ($result < 0) {
throw new RestException(500, 'Error when validating Commercial Proposal: '.$this->propal->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Commercial Proposal validated'
'message' => 'Commercial Proposal validated (Ref='.$this->propal->ref.')'
)
);
}
/**
* Validate fields before create or update object
*
*
* @param array $data Array with data to verify
* @return array
* @return array
* @throws RestException
*/
function _validate($data)
{
$propal = array();
foreach (Orders::$FIELDS as $field) {
foreach (Proposals::$FIELDS as $field) {
if (!isset($data[$field]))
throw new RestException(400, "$field field missing");
$propal[$field] = $data[$field];
}
return $propal;
}

View File

@ -73,9 +73,9 @@ $search_zip=GETPOST('search_zip','alpha');
$search_state=trim(GETPOST("search_state"));
$search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$viewstatut=GETPOST('viewstatut');
$viewstatut=GETPOST('viewstatut','alpha');
$optioncss = GETPOST('optioncss','alpha');
$object_statut=GETPOST('propal_statut');
$object_statut=GETPOST('propal_statut','alpha');
$sall=GETPOST('sall', 'alphanohtml');
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
@ -734,7 +734,7 @@ if ($resql)
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}

View File

@ -80,8 +80,8 @@ class Orders extends DolibarrApi
return $this->_cleanObjectDatas($this->commande);
}
/**
* List orders
*
@ -101,7 +101,7 @@ class Orders extends DolibarrApi
global $db, $conf;
$obj_ret = array();
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
@ -125,7 +125,7 @@ class Orders extends DolibarrApi
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
if ($sqlfilters)
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
@ -134,7 +134,7 @@ class Orders extends DolibarrApi
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
@ -490,7 +490,7 @@ class Orders extends DolibarrApi
return array(
'success' => array(
'code' => 200,
'message' => 'Order validated'
'message' => 'Order validated (Ref='.$this->commande->ref.')'
)
);
}
@ -502,14 +502,14 @@ class Orders extends DolibarrApi
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object) {
$object = parent::_cleanObjectDatas($object);
unset($object->address);
return $object;
}
/**
* Validate fields before create or update object
*

View File

@ -1000,7 +1000,7 @@ class Commande extends CommonOrder
$this->db->begin();
// get extrafields so they will be clone
// get lines so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);

View File

@ -120,11 +120,11 @@ if ($resql)
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre("Town",$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("AccountancyCode",$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
// Lignes des champs de filtre
@ -146,7 +146,7 @@ if ($resql)
print '<td align="right" colspan="2" class="liste_titre">';
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";
$var=true;
@ -155,7 +155,7 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>';

View File

@ -1036,7 +1036,7 @@ if ($resql)
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}

View File

@ -602,12 +602,12 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'c.ref','','&amp;socid='.$socid,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('RefCustomerOrder'),$_SERVER["PHP_SELF"],'c.ref_client','','&amp;socid='.$socid,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','','&amp;socid='.$socid, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','','&amp;socid='.$socid, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),'','','','','align="right"');
print_liste_field_titre($langs->trans('GenerateBill'),'','','','','align="center"');
print_liste_field_titre('Ref',$_SERVER["PHP_SELF"],'c.ref','','&amp;socid='.$socid,'',$sortfield,$sortorder);
print_liste_field_titre('RefCustomerOrder',$_SERVER["PHP_SELF"],'c.ref_client','','&amp;socid='.$socid,'',$sortfield,$sortorder);
print_liste_field_titre('OrderDate',$_SERVER["PHP_SELF"],'c.date_commande','','&amp;socid='.$socid, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre('DeliveryDate',$_SERVER["PHP_SELF"],'c.date_livraison','','&amp;socid='.$socid, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre('Status','','','','','align="right"');
print_liste_field_titre('GenerateBill','','','','','align="center"');
print '</tr>';
// Lignes des champs de filtre

View File

@ -896,7 +896,7 @@ if ($resql)
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}

View File

@ -86,9 +86,9 @@ class PaymentVarious extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
$sql.= " tms=".$this->db->idate($this->tms).",";
$sql.= " datep=".$this->db->idate($this->datep).",";
$sql.= " datev=".$this->db->idate($this->datev).",";
$sql.= " tms='".$this->db->idate($this->tms)."',";
$sql.= " datep='".$this->db->idate($this->datep)."',";
$sql.= " datev='".$this->db->idate($this->datev)."',";
$sql.= " sens=".$this->sens.",";
$sql.= " amount=".price2num($this->amount).",";
$sql.= " fk_typepayment=".$this->fk_typepayment."',";

View File

@ -418,7 +418,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}
@ -492,12 +492,10 @@ foreach ($accounts as $key=>$type)
// Account number
if (! empty($arrayfields['b.account_number']['checked']))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$acc->account_number);
print '<td>'.length_accountg($accountingaccount->getNomUrl(0,1,1,'',1)).'</td>';
print '<td>'.$accountingaccount->getNomUrl(0,1,1,'',1).'</td>';
if (! $i) $totalarray['nbfield']++;
}

View File

@ -275,6 +275,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$refcomp=$societestatic->getNomUrl(1,'',24);
$paiement = $facturestatic->getSommePaiement(); // Payment already done
$paiement+= $facturestatic->getSumDepositsUsed();
$paiement+= $facturestatic->getSumCreditNotesUsed();
}
if ($obj->family == 'social_contribution')
{

View File

@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
@ -70,7 +71,7 @@ if (empty($reshook))
{
if ($action != 'addlink')
{
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/myobject_list.php',1);
$urltogo=$backtopage?$backtopage:dol_buildpath('/compta/bank/various_payment/index.php',1);
header("Location: ".$urltogo);
exit;
}
@ -172,7 +173,7 @@ if (empty($reshook))
if ($result >= 0)
{
$db->commit();
header("Location: ".DOL_URL_ROOT.'/compta/salaries/index.php');
header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/index.php');
exit;
}
else
@ -339,9 +340,9 @@ if ($id)
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
print "<tr>";
print "<tr>";
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '</td></tr>';
@ -349,11 +350,13 @@ if ($id)
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
// Payment date
print "<tr>";
print '<td>'.$langs->trans("DatePayment").'</td><td>';
print dol_print_date($object->datep,'day');
print '</td></tr>';
// Value date
print '<tr><td>'.$langs->trans("DateValue").'</td><td>';
print dol_print_date($object->datev,'day');
print '</td></tr>';
@ -370,11 +373,10 @@ if ($id)
print '</td><td>';
if (! empty($conf->accounting->enabled))
{
$accountancyaccount = new AccountingAccount($db);
$accountancyaccount->fetch('',$object->accountancy_code);
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$object->accountancy_code);
print $accountancyaccount->getNomUrl(1);
// print length_accountg($object->accountancy_code);
print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code;
}
@ -411,7 +413,7 @@ if ($id)
print '<div class="tabsAction">'."\n";
if ($object->rappro == 0)
{
if (! empty($user->rights->banque->delete))
if (! empty($user->rights->banque->modifier))
{
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
}

View File

@ -17,18 +17,18 @@
*/
/**
* \file htdocs/compta/bank/various_payment/index.php
* \file htdocs/compta/bank/various_payment/index.php
* \ingroup bank
* \brief List of various payments
* \brief List of various payments
*/
require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
$langs->load("compta");
$langs->load("banks");
$langs->load("bills");
$langs->loadLangs(array("compta","banks","bills","accountancy"));
// Security check
$socid = GETPOST("socid","int");
@ -41,7 +41,8 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$search_ref = GETPOST('search_ref','int');
$search_user = GETPOST('search_user','alpha');
$search_label = GETPOST('search_label','alpha');
$search_amount = GETPOST('search_amount','alpha');
$search_amount_deb = GETPOST('search_amount_deb','alpha');
$search_amount_cred = GETPOST('search_amount_cred','alpha');
$search_account = GETPOST('search_account','int');
$sortfield = GETPOST("sortfield",'alpha');
@ -75,7 +76,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
{
$search_ref="";
$search_label="";
$search_amount="";
$search_amount_deb="";
$search_amount_cred="";
$search_account='';
$typeid="";
}
@ -90,8 +92,8 @@ $form = new Form($db);
$variousstatic = new PaymentVarious($db);
$accountstatic = new Account($db);
$sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
$sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
$sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
@ -102,7 +104,8 @@ $sql.= " WHERE v.entity = ".$conf->entity;
// Search criteria
if ($search_ref) $sql.=" AND v.rowid=".$search_ref;
if ($search_label) $sql.=natural_search(array('v.label'), $search_label);
if ($search_amount) $sql.=natural_search("v.amount", $search_amount, 1);
if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1);
if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1);
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
if ($filtre) {
$filtre=str_replace(":","=",$filtre);
@ -113,7 +116,6 @@ if ($typeid) {
}
$sql.= $db->order($sortfield,$sortorder);
//$sql.= " GROUP BY u.rowid, u.lastname, u.firstname, v.rowid, v.fk_user, v.amount, v.label, v.datev, v.fk_typepayment, v.num_payment, pst.code";
$totalnboflines=0;
$result=$db->query($sql);
if ($result)
@ -151,29 +153,35 @@ if ($result)
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Sens"),$_SERVER["PHP_SELF"],"v.sens","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("AccountAccounting",$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Debit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Credit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
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>';
// Label
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.$search_label.'"></td>';
// Date
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>';
// Account
if (! empty($conf->banque->enabled))
{
@ -181,10 +189,15 @@ if ($result)
$form->select_comptes($search_account,'search_account',0,'',1);
print '</td>';
}
// Amount
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
// Sens
print '<td class="liste_titre">&nbsp;</td>';
// Accounting account
if (! empty($conf->accounting->enabled)) print '<td class="liste_titre">&nbsp;</td>';
// Debit
print '<td class="liste_titre" align="right"><input name="search_amount_deb" class="flat" type="text" size="8" value="'.$search_amount_deb.'"></td>';
// Credit
print '<td class="liste_titre" align="right"><input name="search_amount_cred" class="flat" type="text" size="8" value="'.$search_amount_cred.'"></td>';
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
@ -193,6 +206,7 @@ if ($result)
print "</tr>\n";
$totalarray=array();
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
@ -201,50 +215,81 @@ if ($result)
$variousstatic->id=$obj->rowid;
$variousstatic->ref=$obj->rowid;
// Ref
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
// Label payment
print "<td>".dol_trunc($obj->label,40)."</td>\n";
// Date payment
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
// Account
if (! empty($conf->banque->enabled))
{
print '<td>';
if ($obj->fk_bank > 0)
{
//$accountstatic->fetch($obj->fk_bank);
$accountstatic->id=$obj->bid;
$accountstatic->ref=$obj->bref;
$accountstatic->number=$obj->bnumber;
$accountstatic->accountancy_number=$obj->account_number;
$accountstatic->fk_accountancy_journal=$obj->fk_accountancy_journal;
if (! empty($conf->accounting->enabled)) {
$accountstatic->account_number=$obj->bank_account_number;
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($obj->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->code;
}
$accountstatic->label=$obj->blabel;
print $accountstatic->getNomUrl(1);
}
else print '&nbsp;';
print '</td>';
}
// Amount
print "<td align=\"right\">".price($obj->amount)."</td>";
// Sens
if ($obj->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit");
print "<td align=\"right\">".$sens."</td>";
print "<td></td>";
print "</tr>\n";
$total = $total + $obj->amount;
// Accounting account
if (! empty($conf->accounting->enabled)) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$obj->accountancy_code);
print '<td>'.$accountingaccount->getNomUrl(0,1,1,'',1).'</td>';
}
// Debit
print "<td align=\"right\">";
if ($obj->sens == 0)
{
print price($obj->amount);
$totalarray['totaldeb'] += $obj->amount;
}
print "</td>";
// Credit
print "<td align=\"right\">";
if ($obj->sens == 1)
{
print price($obj->amount);
$totalarray['totalcred'] += $obj->amount;
}
print "</td>";
print "<td></td>";
$i++;
}
$colspan=4;
$colspan=5;
if (! empty($conf->banque->enabled)) $colspan++;
print '<tr class="liste_total">';
print '<td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total" align="right">'.price($total)."</td>";
print '<td class="liste_total" align="right">'.price($totalarray['totaldeb'])."</td>";
print '<td class="liste_total" align="right">'.price($totalarray['totalcred'])."</td>";
print '<td></td>';
print '<td></td>';
print '</tr>';

View File

@ -92,7 +92,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($mode != 'sconly')
if ($mode != 'sconly')
{
$center=($year?'<a href="index.php?year='.($year-1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="index.php?year='.($year+1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>":"");
print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$center,$num,$totalnboflines, 'title_accountancy', 0, '', '', $limit, 1);
@ -120,15 +120,15 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$sql = "SELECT c.id, c.libelle as lib,";
@ -278,14 +278,14 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
@ -294,7 +294,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
@ -309,12 +309,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
// Date
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
// Type payment
print '<td>';
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
print $obj->num_payment.'</td>';
// Account
if (! empty($conf->banque->enabled))
{
@ -333,7 +333,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
else print '&nbsp;';
print '</td>';
}
// Paid
print '<td align="right">'.price($obj->amount)."</td>";
print "</tr>\n";
@ -411,11 +411,11 @@ while($j<$numlt)
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
@ -424,7 +424,7 @@ while($j<$numlt)
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
@ -465,8 +465,8 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$sal = new PaymentSalary($db);
print "<br>";
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
print_fiche_titre( $langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, s.fk_bank, u.salary as current_salary,";
$sql.= " pct.code as payment_code,";
@ -493,13 +493,13 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
@ -508,7 +508,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dateep),'day').'</td>'."\n";
@ -527,7 +527,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
print '<td>';
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
print $obj->num_payment.'</td>';
// Account
if (! empty($conf->banque->enabled))
{
@ -546,7 +546,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
else print '&nbsp;';
print '</td>';
}
// Paid
print '<td align="right">'.price($obj->amount)."</td>";
print "</tr>\n";

View File

@ -69,7 +69,7 @@ if ($action == 'note')
$result = $db->query($sql);
}
if ($mode == 'search')
if ($mode == 'search')
{
$resql=$db->query($sql);
if ($resql) {
@ -144,11 +144,11 @@ if ($resql)
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre("Town",$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("AccountancyCode",$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
// Lignes des champs de filtre
@ -178,7 +178,7 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>';

View File

@ -133,12 +133,12 @@ if ($resql)
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<table class="noborder" width="100%">';
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",'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);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"d.type","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Person",$_SERVER["PHP_SELF"],"u.lastname","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre("FeesKilometersOrAmout",$_SERVER["PHP_SELF"],"d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
@ -178,7 +178,7 @@ if ($resql)
$soc = new Societe($db);
if ($obj->socid) $soc->fetch($obj->socid);
print '<tr class="oddeven">';
// Id
print '<td><a href="card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowTrip"),"trip").' '.$obj->rowid.'</a></td>';

View File

@ -22,14 +22,14 @@
/**
* API class for invoices
*
* @access protected
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
class Invoices extends DolibarrApi
{
/**
*
* @var array $FIELDS Mandatory fields, checked when create and update object
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
static $FIELDS = array(
'socid'
@ -54,23 +54,23 @@ class Invoices extends DolibarrApi
* Get properties of a invoice object
*
* Return an array with invoice informations
*
*
* @param int $id ID of invoice
* @return array|mixed data without useless information
*
* @throws RestException
*/
function get($id)
{
{
if(! DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@ -80,9 +80,9 @@ class Invoices extends DolibarrApi
/**
* List invoices
*
*
* Get a list of invoices
*
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
@ -96,12 +96,12 @@ class Invoices extends DolibarrApi
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') {
global $db, $conf;
$obj_ret = array();
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
@ -109,7 +109,7 @@ class Invoices extends DolibarrApi
$sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql.= " FROM ".MAIN_DB_PREFIX."facture as t";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ' WHERE t.entity IN ('.getEntity('facture').')';
@ -117,7 +117,7 @@ class Invoices extends DolibarrApi
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Filter by status
if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)";
@ -129,7 +129,7 @@ class Invoices extends DolibarrApi
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
if ($sqlfilters)
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
@ -138,7 +138,7 @@ class Invoices extends DolibarrApi
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
@ -174,10 +174,10 @@ class Invoices extends DolibarrApi
}
return $obj_ret;
}
/**
* Create invoice object
*
*
* @param array $request_data Request datas
* @return int ID of invoice
*/
@ -188,7 +188,7 @@ class Invoices extends DolibarrApi
}
// Check mandatory fields
$result = $this->_validate($request_data);
foreach($request_data as $field => $value) {
$this->invoice->$field = $value;
}
@ -203,7 +203,7 @@ class Invoices extends DolibarrApi
}
$this->invoice->lines = $lines;
}*/
if ($this->invoice->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating invoice", array_merge(array($this->invoice->error), $this->invoice->errors));
}
@ -214,20 +214,20 @@ class Invoices extends DolibarrApi
* Update invoice
*
* @param int $id Id of invoice to update
* @param array $request_data Datas
* @return int
* @param array $request_data Datas
* @return int
*/
function put($id, $request_data = NULL)
{
if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@ -236,13 +236,13 @@ class Invoices extends DolibarrApi
if ($field == 'id') continue;
$this->invoice->$field = $value;
}
if($this->invoice->update($id, DolibarrApiAccess::$user))
return $this->get ($id);
return false;
}
/**
* Delete invoice
*
@ -258,16 +258,16 @@ class Invoices extends DolibarrApi
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( $this->invoice->delete($id) < 0)
{
throw new RestException(500);
}
return array(
'success' => array(
'code' => 200,
@ -275,13 +275,76 @@ class Invoices extends DolibarrApi
)
);
}
/**
* Validate an order
*
* @param int $id Order ID
* @param int $idwarehouse Warehouse ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
*
* @url POST {id}/validate
*
* @return array
* FIXME An error 403 is returned if the request has an empty body.
* Error message: "Forbidden: Content type `text/plain` is not supported."
* Workaround: send this in the body
* {
* "idwarehouse": 0,
* "notrigger": 0
* }
*/
function validate($id, $idwarehouse=0, $notrigger=0)
{
if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
if ($result == 0) {
throw new RestException(500, 'Error nothing done. May be object is already validated');
}
if ($result < 0) {
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Invoice validated (Ref='.$this->invoice->ref.')'
)
);
}
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object) {
$object = parent::_cleanObjectDatas($object);
unset($object->address);
return $object;
}
/**
* Validate fields before create or update object
*
*
* @param array|null $data Datas to validate
* @return array
*
*
* @throws RestException
*/
function _validate($data)
@ -294,5 +357,5 @@ class Invoices extends DolibarrApi
}
return $invoice;
}
}

View File

@ -748,6 +748,15 @@ class Facture extends CommonInvoice
// Charge facture source
$facture=new Facture($this->db);
$this->fetch_optionals();
if(!empty($this->array_options)){
$facture->array_options = $this->array_options;
}
foreach($this->lines as &$line){
$line->fetch_optionals();//fetch extrafields
}
$facture->fk_facture_source = $this->fk_facture_source;
$facture->type = $this->type;

View File

@ -979,7 +979,7 @@ if ($resql)
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}

View File

@ -151,9 +151,9 @@ class Localtax extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET";
$sql.= " localtaxtype=".$this->ltt.",";
$sql.= " tms=".$this->db->idate($this->tms).",";
$sql.= " datep=".$this->db->idate($this->datep).",";
$sql.= " datev=".$this->db->idate($this->datev).",";
$sql.= " tms='".$this->db->idate($this->tms)."',";
$sql.= " datep='".$this->db->idate($this->datep)."',";
$sql.= " datev='".$this->db->idate($this->datev)."',";
$sql.= " amount=".price2num($this->amount).",";
$sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " note='".$this->db->escape($this->note)."',";

View File

@ -854,10 +854,10 @@ if (! GETPOST('action','aZ09'))
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'facnumber','','','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder);
print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'facnumber','','','',$sortfield,$sortorder);
print_liste_field_titre('Date',$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder);
print_liste_field_titre('Type',$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder);
print_liste_field_titre('Amount',$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";

View File

@ -101,17 +101,17 @@ if ($resql)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.rowid","","",'width="60"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","","",'width="80" align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"c.libelle","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"p.rowid","","",'width="60"',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"dp","","",'width="80" align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle","","","",$sortfield,$sortorder);
print_liste_field_titre("AmountTTC",$_SERVER["PHP_SELF"],"c.libelle","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td><a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid.'</a></td>';
print '<td width="80" align="center">'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";

View File

@ -373,7 +373,7 @@ if ($action == 'new')
{
$paymentstatic=new Paiement($db);
$accountlinestatic=new AccountLine($db);
$lines = array();
$now=dol_now();
@ -474,7 +474,7 @@ if ($action == 'new')
$moreforfilter='';
print '<div class="div-table-responsive-no-min">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print '<td style="min-width: 120px">'.$langs->trans("DateChequeReceived").'</td>'."\n";
print '<td style="min-width: 120px">'.$langs->trans("ChequeNumber")."</td>\n";
@ -529,18 +529,18 @@ if ($action == 'new')
print '&nbsp;';
}
print '</td>';
print '<td align="center">';
print '<input id="'.$value["id"].'" class="flat checkforremise_'.$bid.'" checked type="checkbox" name="toRemise[]" value="'.$value["id"].'">';
print '</td>' ;
print '</tr>';
$i++;
}
}
print "</table>";
print '</div>';
print '<div class="tabsAction">';
if ($user->rights->banque->cheque)
{
@ -563,15 +563,15 @@ else
$accountstatic->fetch($object->account_id);
$linkback='<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlref='';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">';
@ -626,7 +626,7 @@ else
print '</td>';
print '</tr>';
*/
print '<tr><td>'.$langs->trans('Account').'</td><td colspan="2">';
print $accountstatic->getNomUrl(1);
print '</td></tr>';
@ -648,7 +648,7 @@ else
print '</div>';
// List of cheques
$sql = "SELECT b.rowid, b.amount, b.num_chq, b.emetteur,";
$sql.= " b.dateo as date, b.datec as datec, b.banque,";
@ -670,16 +670,16 @@ else
print '<table class="noborder" width="100%">';
$param="&amp;id=".$object->id;
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Cheques"),'','','','','width="30"');
print_liste_field_titre($langs->trans("DateChequeReceived"),$_SERVER["PHP_SELF"],"b.dateo,b.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"b.num_chq", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CheckTransmitter"),$_SERVER["PHP_SELF"],"b.emetteur", "",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Bank"),$_SERVER["PHP_SELF"],"b.banque", "",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"b.amount", "",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Payment"),$_SERVER["PHP_SELF"],"p.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("LineRecord"),$_SERVER["PHP_SELF"],"b.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Cheques",'','','','','width="30"');
print_liste_field_titre("DateChequeReceived",$_SERVER["PHP_SELF"],"b.dateo,b.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Numero",$_SERVER["PHP_SELF"],"b.num_chq", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("CheckTransmitter",$_SERVER["PHP_SELF"],"b.emetteur", "",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Bank",$_SERVER["PHP_SELF"],"b.banque", "",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"b.amount", "",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Payment",$_SERVER["PHP_SELF"],"p.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("LineRecord",$_SERVER["PHP_SELF"],"b.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
$i=1;
@ -692,7 +692,7 @@ else
if (! isset($accounts[$objp->bid]))
$accounts[$objp->bid]=0;
$accounts[$objp->bid] += 1;
print '<tr class="oddeven">';
print '<td align="center">'.$i.'</td>';
print '<td align="center">'.dol_print_date($db->jdate($objp->date),'day').'</td>'; // Date operation
@ -735,13 +735,13 @@ else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reject_check&amp;lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"),'disable').'</a>';
}
if ($objp->statut == 2)
if ($objp->statut == 2)
{
print ' &nbsp; '.img_picto($langs->trans('CheckRejected'),'statut8').'</a>';
}
print '</td>';
print '</tr>';
$i++;
}
}
@ -751,7 +751,7 @@ else
print $langs->trans("None");
print '</td>';
}
print "</table>";
print "</div>";
}

View File

@ -172,12 +172,12 @@ if ($resql)
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.ref","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("NbOfCheques"),$_SERVER["PHP_SELF"],"bc.nbcheque","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"bc.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"bc.statut","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"bc.ref","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("NbOfCheques",$_SERVER["PHP_SELF"],"bc.nbcheque","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"bc.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"bc.statut","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";

View File

@ -3,8 +3,9 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.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
@ -31,14 +32,15 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
$langs->load("bills");
$langs->load("compta");
// Security check
$facid =GETPOST('facid','int');
$socid =GETPOST('socid','int');
$userid=GETPOST('userid','int');
$facid = GETPOST('facid','int');
$socid = GETPOST('socid','int');
$userid = GETPOST('userid','int');
$day = GETPOST('day','int');
$month = GETPOST('month','int');
$year = GETPOST('year','int');
@ -129,7 +131,7 @@ else
$sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives
$sql.= " p.statut, p.num_paiement,";
$sql.= " c.code as paiement_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.accountancy_journal as accountancy_journal,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,";
$sql.= " s.rowid as socid, s.nom as name";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
@ -177,7 +179,7 @@ else
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'";
if ($search_payment_num != '') $sql .= natural_search('p.num_paiement', $search_payment_num);
if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1);
if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1);
if ($search_company) $sql .= natural_search('s.nom', $search_company);
// Add where from hooks
$parameters=array();
@ -211,7 +213,7 @@ if ($resql)
$param.=($search_amount?"&search_amount=".urlencode($search_amount):"");
$param.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):"");
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -220,9 +222,9 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png', 0, '', '', $limit);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@ -266,26 +268,26 @@ if ($resql)
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Numero",$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder);
if (! empty($conf->banque->enabled))
{
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder);
//print_liste_field_titre("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder);
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);
@ -314,7 +316,7 @@ if ($resql)
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$objp->paiement_code).'</td>';
// Payment number
print '<td>'.$objp->num_paiement.'</td>';
@ -329,7 +331,11 @@ if ($resql)
$accountstatic->label=$objp->blabel;
$accountstatic->number=$objp->number;
$accountstatic->account_number=$objp->account_number;
$accountstatic->accountancy_journal=$objp->accountancy_journal;
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->code;
print $accountstatic->getNomUrl(1);
}
else print '&nbsp;';

View File

@ -125,9 +125,9 @@ if ($result)
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"');
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"","","",'align="center"');
print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"');
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"","","",'align="center"');
print "</tr>\n";
while ($i < min($num,$limit))

View File

@ -308,9 +308,9 @@ if ($id > 0)
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Lines"),$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"pl.amount","",$urladd,'align="right"');
print_liste_field_titre("Lines",$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd);
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$urladd);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"pl.amount","",$urladd,'align="right"');
print_liste_field_titre('');
print "</tr>\n";
@ -354,7 +354,7 @@ if ($id > 0)
print '</td></tr>';
$total += $obj->amount;
$i++;
}

View File

@ -106,14 +106,14 @@ if ($resql)
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Bill"), $_SERVER["PHP_SELF"]);
print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"]);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "", "", $param, 'align="right"');
print_liste_field_titre($langs->trans("DateRequest"), $_SERVER["PHP_SELF"], "", "", $param, 'align="center"');
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]);
print_liste_field_titre("Company", $_SERVER["PHP_SELF"]);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"');
print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"');
print_liste_field_titre('');
print '</tr>';
@ -136,7 +136,7 @@ if ($resql)
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
// Ref facture
@ -157,7 +157,7 @@ if ($resql)
print '<td align="center">'.dol_print_date($db->jdate($obj->date_demande),'day').'</td>';
print '<td align="right"></td>';
print '</tr>';
$i++;
}

View File

@ -171,16 +171,16 @@ if ($result)
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
$massactionbutton='';
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
print"\n<!-- debut table -->\n";
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Bill"),$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("StatusDebitCredit"),$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder);
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$param,'',$sortfield,$sortorder);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("StatusDebitCredit",$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
@ -194,12 +194,12 @@ if ($result)
$invoicetmp->id = $obj->facid;
$invoicetmp->ref = $obj->ref;
$thirdpartytmp->id = $obj->socid;
$thirdpartytmp->name = $obj->name;
print '<tr class="oddeven">';
print "<td>";
print $invoicetmp->getNomUrl(1);
print "</td>\n";
@ -228,13 +228,13 @@ if ($result)
}
print "</td>";
print "<td></td>";
print "</tr>\n";
$total += $obj->total_ttc;
$i++;
}

View File

@ -149,13 +149,13 @@ if ($result)
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"]);
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref");
print_liste_field_titre($langs->trans("Bill"),$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom");
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client",'','','align="center"');
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'align="center"');
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"pl.amount","","",'align="right"');
print_liste_field_titre("Line",$_SERVER["PHP_SELF"]);
print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref");
print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom");
print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client",'','','align="center"');
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'align="center"');
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"pl.amount","","",'align="right"');
print_liste_field_titre('');
print "</tr>\n";

View File

@ -89,9 +89,9 @@ if ($result)
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"],"p.ref",'',$urladd);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd);
print_liste_field_titre($langs->trans("Reason"),$_SERVER["PHP_SELF"],"pr.motif","",$urladd);
print_liste_field_titre("Line",$_SERVER["PHP_SELF"],"p.ref",'',$urladd);
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$urladd);
print_liste_field_titre("Reason",$_SERVER["PHP_SELF"],"pr.motif","",$urladd);
print "</tr>\n";
$total = 0;
@ -110,7 +110,7 @@ if ($result)
print '<td>'.$rej->motifs[$obj->motif].'</td>';
print "</tr>\n";
$i++;
}

View File

@ -177,12 +177,12 @@ if ($date_endyear) $param.='&date_endyear='.$date_startyear;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Name"), $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder);
print_liste_field_titre("Name", $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder);
if ($modecompta == 'CREANCES-DETTES')
{
print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"],'amount_ht','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"],'amount_ht','',$param,'align="right"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("AmountTTC"), $_SERVER["PHP_SELF"],'amount_ttc','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("AmountTTC", $_SERVER["PHP_SELF"],'amount_ttc','',$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
/*
@ -234,7 +234,7 @@ if ($result) {
while ($i < $num)
{
$objp = $db->fetch_object($result);
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("Bills").' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$objp->socid.'">'.$objp->name."</td>\n";
@ -278,7 +278,7 @@ if ($modecompta != 'CREANCES-DETTES')
while ($i < $num)
{
$objp = $db->fetch_object($result);
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("Bills")." ".$langs->trans("Other")." (".$langs->trans("PaymentsNotLinkedToInvoice").")\n";
@ -301,7 +301,7 @@ if ($modecompta != 'CREANCES-DETTES')
}
if ($total_ttc == 0)
{
{
print '<tr class="oddeven"><td>&nbsp;</td>';
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
print '</tr>';
@ -363,7 +363,7 @@ if ($result) {
while ($i < $num)
{
$objp = $db->fetch_object($result);
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("Bills")." <a href=\"".DOL_URL_ROOT."/fourn/facture/list.php?socid=".$objp->socid."\">".$objp->name."</a></td>\n";
@ -381,7 +381,7 @@ if ($result) {
}
}
else
{
{
print '<tr class="oddeven"><td>&nbsp;</td>';
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
print '</tr>';
@ -581,7 +581,7 @@ if (! empty($conf->salaries->enabled))
$column = 'p.datep';
}
print '<tr><td colspan="4">'.$langs->trans("Salaries").'</td></tr>';
print '<tr><td colspan="4">'.$langs->trans("Salaries").'</td></tr>';
$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
@ -595,7 +595,7 @@ if (! empty($conf->salaries->enabled))
if ($newsortfield == 'amount_ht') $newsortfield = 'amount';
if ($newsortfield == 'amount_ttc') $newsortfield = 'amount';
$sql.= $db->order($newsortfield, $sortorder);
dol_syslog("get payment salaries");
$result=$db->query($sql);
$subtotal_ht = 0;
@ -676,7 +676,7 @@ if (! empty($conf->expensereport->enabled))
{
$sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
}
$sql.= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm";
$newsortfield = $sortfield;
if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.ref';
@ -746,7 +746,7 @@ if (! empty($conf->don->enabled))
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
$sql.= " WHERE p.entity = ".getEntity('donation');
$sql.= " AND fk_statut >= 2";
$sql.= " AND fk_statut >= 2";
}
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";

View File

@ -34,7 +34,7 @@ class PaymentSalary extends CommonObject
//public $element='payment_salary'; //!< Id that identify managed objects
//public $table_element='payment_salary'; //!< Name of table without prefix where object is stored
public $picto='payment';
public $tms;
public $fk_user;
public $datep;
@ -97,16 +97,16 @@ class PaymentSalary extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
$sql.= " tms=".$this->db->idate($this->tms).",";
$sql.= " tms='".$this->db->idate($this->tms)."',";
$sql.= " fk_user=".$this->fk_user.",";
$sql.= " datep=".$this->db->idate($this->datep).",";
$sql.= " datev=".$this->db->idate($this->datev).",";
$sql.= " datep='".$this->db->idate($this->datep)."',";
$sql.= " datev='".$this->db->idate($this->datev)."',";
$sql.= " amount=".price2num($this->amount).",";
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
$sql.= " num_payment='".$this->db->escape($this->num_payment)."',";
$sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " datesp=".$this->db->idate($this->datesp).",";
$sql.= " dateep=".$this->db->idate($this->dateep).",";
$sql.= " datesp='".$this->db->idate($this->datesp)."',";
$sql.= " dateep='".$this->db->idate($this->dateep)."',";
$sql.= " note='".$this->db->escape($this->note)."',";
$sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->fk_bank."'":"null").",";
$sql.= " fk_user_author=".$this->fk_user_author.",";
@ -548,7 +548,7 @@ class PaymentSalary extends CommonObject
}
}
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
*
@ -559,7 +559,7 @@ class PaymentSalary extends CommonObject
{
return $this->LibStatut($this->statut,$mode);
}
/**
* Renvoi le libelle d'un statut donne
*
@ -570,7 +570,7 @@ class PaymentSalary extends CommonObject
function LibStatut($status,$mode=0)
{
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
$langs->load('compta');
/*if ($mode == 0)
{
@ -609,5 +609,5 @@ class PaymentSalary extends CommonObject
}*/
return '';
}
}

View File

@ -197,13 +197,13 @@ if ($result)
print '</td>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Employee",$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";

View File

@ -154,7 +154,7 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
if ($year)
{
$center=($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":"");
@ -177,7 +177,7 @@ if ($resql)
{
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre_filter">';
// Ref
print '<td class="liste_titre" align="left">';
@ -209,16 +209,16 @@ if ($resql)
print "</tr>\n";
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);
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"periode","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cs.paye","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"periode","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("DateDue",$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"cs.paye","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
$i=0;
$totalarray=array();
while ($i < min($num,$limit))
@ -258,7 +258,7 @@ if ($resql)
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->amount;
// Due date
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
@ -285,7 +285,7 @@ if ($resql)
print '<td></td>';
print '</tr>';
}
print '</table>';
print '</div>';
}

View File

@ -88,7 +88,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($mode != 'sconly')
if ($mode != 'sconly')
{
$center=($year?'<a href="index.php?year='.($year-1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="index.php?year='.($year+1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>":"");
print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$center,$num,$totalnboflines, 'title_accountancy', 0, '', '', $limit, 1);
@ -116,14 +116,14 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("LabelContrib"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("TypeContrib"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("LabelContrib",$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("TypeContrib",$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$sql = "SELECT c.id, c.libelle as lib,";
@ -246,12 +246,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
@ -260,7 +260,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
@ -348,12 +348,12 @@ while($j<$numlt)
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
@ -362,7 +362,7 @@ while($j<$numlt)
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
@ -408,7 +408,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$sal = new PaymentSalary($db);
print "<br>";
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, u.salary as current_salary";
@ -430,12 +430,12 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
@ -444,7 +444,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dateep),'day').'</td>'."\n";

View File

@ -173,9 +173,9 @@ class Tva extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
$sql.= " tms=".$this->db->idate($this->tms).",";
$sql.= " datep=".$this->db->idate($this->datep).",";
$sql.= " datev=".$this->db->idate($this->datev).",";
$sql.= " tms='".$this->db->idate($this->tms)."',";
$sql.= " datep='".$this->db->idate($this->datep)."',";
$sql.= " datev='".$this->db->idate($this->datev)."',";
$sql.= " amount=".price2num($this->amount).",";
$sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " note='".$this->db->escape($this->note)."',";

View File

@ -156,9 +156,9 @@ if ($result)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines, 'title_accountancy', 0, '', '', $limit);
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
@ -190,16 +190,16 @@ if ($result)
print "</tr>\n";
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("DateValue"),$_SERVER["PHP_SELF"],"dv","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DateValue",$_SERVER["PHP_SELF"],"dv","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
@ -252,7 +252,7 @@ if ($result)
$i++;
}
$colspan=5;
if (! empty($conf->banque->enabled)) $colspan++;
print '<tr class="liste_total"><td colspan="'.$colspan.'">'.$langs->trans("Total").'</td>';
@ -261,7 +261,7 @@ if ($result)
print "</table>";
print '</div>';
print '</form>';
$db->free($result);

View File

@ -48,12 +48,15 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $contactid,'');
$sall=GETPOST('sall', 'alphanohtml');
$search_cti=preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars
$search_phone=GETPOST("search_phone");
$search_id=trim(GETPOST("search_id","int"));
$search_firstlast_only=GETPOST("search_firstlast_only");
$search_lastname=GETPOST("search_lastname");
$search_firstname=GETPOST("search_firstname");
$search_societe=GETPOST("search_societe");
$search_poste=GETPOST("search_poste");
$search_phone=GETPOST("search_phone");
$search_phone_perso=GETPOST("search_phone_perso");
$search_phone_pro=GETPOST("search_phone_pro");
$search_phone_mobile=GETPOST("search_phone_mobile");
@ -66,6 +69,7 @@ $search_categ_thirdparty=GETPOST("search_categ_thirdparty",'int');
$search_categ_supplier=GETPOST("search_categ_supplier",'int');
$search_status=GETPOST("search_status",'int');
$search_type=GETPOST('search_type','alpha');
$search_import_key = GETPOST("search_import_key","alpha");
if ($search_status=='') $search_status=1; // always display activ customer first
$optioncss = GETPOST('optioncss','alpha');
@ -132,22 +136,24 @@ $fieldstosearchall = array(
// Definition of fields for list
$arrayfields=array(
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'p.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
'p.poste'=>array('label'=>$langs->trans("PostOrFunction"), 'checked'=>1),
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
'p.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>1),
'p.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
'p.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>1),
'p.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>1),
'p.email'=>array('label'=>$langs->trans("EMail"), 'checked'=>1),
'p.skype'=>array('label'=>$langs->trans("Skype"), 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
'p.thirdparty'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
'p.priv'=>array('label'=>$langs->trans("ContactVisibility"), 'checked'=>1, 'position'=>200),
'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
'p.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0)),
'p.lastname'=>array('label'=>"Lastname", 'checked'=>1),
'p.firstname'=>array('label'=>"Firstname", 'checked'=>1),
'p.poste'=>array('label'=>"PostOrFunction", 'checked'=>1),
'p.town'=>array('label'=>"Town", 'checked'=>0),
'p.zip'=>array('label'=>"Zip", 'checked'=>0),
'p.phone'=>array('label'=>"Phone", 'checked'=>1),
'p.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0),
'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1),
'p.fax'=>array('label'=>"Fax", 'checked'=>1),
'p.email'=>array('label'=>"EMail", 'checked'=>1),
'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
'p.thirdparty'=>array('label'=>"ThirdParty", 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200),
'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'p.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@ -186,6 +192,7 @@ if (empty($reshook))
if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers
{
$sall="";
$search_id='';
$search_firstlast_only="";
$search_lastname="";
$search_firstname="";
@ -203,6 +210,7 @@ if (empty($reshook))
$search_categ='';
$search_categ_thirdparty='';
$search_categ_supplier='';
$search_import_key='';
$toselect='';
$search_array_options=array();
}
@ -272,53 +280,27 @@ if ($search_categ > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_ca
if ($search_categ == -2) $sql.= " AND cc.fk_categorie IS NULL";
if ($search_categ_thirdparty > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_thirdparty);
if ($search_categ_thirdparty == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ_supplier > 0) $sql.= " AND cs2.fk_categorie = ".$db->escape($search_categ_supplier);
if ($search_categ_supplier == -2) $sql.= " AND cs2.fk_categorie IS NULL";
if ($search_categ_supplier > 0) $sql.= " AND cs2.fk_categorie = ".$db->escape($search_categ_supplier);
if ($search_categ_supplier == -2) $sql.= " AND cs2.fk_categorie IS NULL";
if ($search_firstlast_only) {
$sql .= natural_search(array('p.lastname','p.firstname'), $search_firstlast_only);
}
if ($search_lastname) { // filter on lastname
$sql .= natural_search('p.lastname', $search_lastname);
}
if ($search_firstname) { // filter on firstname
$sql .= natural_search('p.firstname', $search_firstname);
}
if ($search_societe) { // filtre sur la societe
$sql .= natural_search('s.nom', $search_societe);
}
if (strlen($search_poste)) { // filtre sur la societe
$sql .= natural_search('p.poste', $search_poste);
}
if (strlen($search_phone))
{
$sql .= " AND (p.phone LIKE '%".$db->escape($search_phone)."%' OR p.phone_perso LIKE '%".$db->escape($search_phone)."%' OR p.phone_mobile LIKE '%".$db->escape($search_phone)."%')";
}
if (strlen($search_phone_perso))
{
$sql .= " AND p.phone_perso LIKE '%".$db->escape($search_phone_perso)."%'";
}
if (strlen($search_phone_pro))
{
$sql .= " AND p.phone LIKE '%".$db->escape($search_phone_pro)."%'";
}
if (strlen($search_phone_mobile))
{
$sql .= " AND p.phone_mobile LIKE '%".$db->escape($search_phone_mobile)."%'";
}
if (strlen($search_fax))
{
$sql .= " AND p.fax LIKE '%".$db->escape($search_fax)."%'";
}
if (strlen($search_email)) // filtre sur l'email
{
$sql .= " AND p.email LIKE '%".$db->escape($search_email)."%'";
}
if (strlen($search_skype)) // filtre sur skype
{
$sql .= " AND p.skype LIKE '%".$db->escape($search_skype)."%'";
}
if ($search_status != '' && $search_status >= 0) $sql .= " AND p.statut = ".$db->escape($search_status);
if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
if (strlen($search_phone)) $sql.= natural_search(array('p.phone', 'p.phone_perso', 'p.phone_mobile'), $search_phone);
if (strlen($search_cti)) $sql.= natural_search(array('p.phone', 'p.phone_perso', 'p.phone_mobile'), $search_cti);
if (strlen($search_firstlast_only)) $sql.= natural_search(array('p.lastname', 'p.firstname'), $search_firstlast_only);
if ($search_id > 0) $sql.= natural_search("p.rowid",$search_id,1);
if ($search_lastname) $sql.= natural_search('p.lastname', $search_lastname);
if ($search_firstname) $sql.= natural_search('p.firstname', $search_firstname);
if ($search_societe) $sql.= natural_search('s.nom', $search_societe);
if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste);
if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso);
if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone);
if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile);
if (strlen($search_fax)) $sql.= natural_search('p.phone_fax', $search_fax);
if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype);
if (strlen($search_email)) $sql.= natural_search('p.email', $search_email);
if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status);
if ($search_import_key) $sql.= natural_search("p.import_key",$search_import_key);
if ($type == "o") // filtre sur type
{
$sql .= " AND p.fk_soc IS NULL";
@ -335,10 +317,6 @@ else if ($type == "p") // filtre sur type
{
$sql .= " AND s.client IN (2, 3)";
}
if ($sall)
{
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
if (! empty($socid))
{
$sql .= " AND s.rowid = ".$socid;
@ -391,7 +369,7 @@ $num = $db->num_rows($result);
$arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $seearch_cti != ''))
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
@ -411,6 +389,7 @@ if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
if (!empty($search_categ_thirdparty)) $param.='&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
if (!empty($search_categ_supplier)) $param.='&search_categ_supplier='.urlencode($search_categ_supplier);
if ($sall != '') $param.='&amp;sall='.urlencode($sall);
if ($search_id > 0) $param.= "&search_id=".urlencode($search_id);
if ($search_lastname != '') $param.='&amp;search_lastname='.urlencode($search_lastname);
if ($search_firstname != '') $param.='&amp;search_firstname='.urlencode($search_firstname);
if ($search_societe != '') $param.='&amp;search_societe='.urlencode($search_societe);
@ -424,6 +403,7 @@ if ($search_fax != '') $param.='&amp;search_fax='.urlencode($search_fax);
if ($search_email != '') $param.='&amp;search_email='.urlencode($search_email);
if ($search_status != '') $param.='&amp;search_status='.urlencode($search_status);
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key);
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
@ -508,6 +488,12 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
// Lines for filter fields
print '<tr class="liste_titre_filter">';
if (! empty($arrayfields['p.rowid']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">';
print '</td>';
}
if (! empty($arrayfields['p.lastname']['checked']))
{
print '<td class="liste_titre">';
@ -629,10 +615,16 @@ if (! empty($arrayfields['p.tms']['checked']))
// Status
if (! empty($arrayfields['p.statut']['checked']))
{
print '<td class="liste_titre" align="center">';
print '<td class="liste_titre center">';
print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
}
if (! empty($arrayfields['p.import_key']['checked']))
{
print '<td class="liste_titre center">';
print '<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).'">';
print '</td>';
}
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
@ -643,19 +635,20 @@ print '</tr>';
// Ligne des titres
print '<tr class="liste_titre">';
if (! empty($arrayfields['p.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.firstname']['checked'])) print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.zip']['checked'])) print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"p.zip", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"p.town", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($langs->trans("PhonePerso"),$_SERVER["PHP_SELF"],"p.phone_perso", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($langs->trans("Skype"),$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($langs->trans("ContactVisibility"),$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $sortfield,$sortorder);
if (! empty($arrayfields['p.rowid']['checked'])) print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['p.lastname']['checked'])) print_liste_field_titre($arrayfields['p.lastname']['label'],$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.firstname']['checked'])) print_liste_field_titre($arrayfields['p.firstname']['label'],$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.zip']['checked'])) print_liste_field_titre($arrayfields['p.zip']['label'],$_SERVER["PHP_SELF"],"p.zip", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($arrayfields['p.town']['label'],$_SERVER["PHP_SELF"],"p.town", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($arrayfields['p.poste']['label'],$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($arrayfields['p.phone']['label'],$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($arrayfields['p.phone_perso']['label'],$_SERVER["PHP_SELF"],"p.phone_perso", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'],$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'],$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'],$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'],$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'],$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'],$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -666,7 +659,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}
@ -674,9 +667,10 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'],$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.import_key']['checked'])) print_liste_field_titre($arrayfields['p.import_key']['label'],$_SERVER["PHP_SELF"],"p.import_key","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
@ -701,7 +695,15 @@ while ($i < min($num,$limit))
$contactstatic->zip=$obj->zip;
$contactstatic->town=$obj->town;
// Name
// ID
if (! empty($arrayfields['p.rowid']['checked']))
{
print '<td class="tdoverflowmax50">';
print $obj->rowid;
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Name
if (! empty($arrayfields['p.lastname']['checked']))
{
print '<td valign="middle">';
@ -836,8 +838,15 @@ while ($i < min($num,$limit))
print '<td align="center">'.$contactstatic->getLibStatut(3).'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['p.import_key']['checked']))
{
print '<td class="tdoverflowmax100">';
print $obj->import_key;
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Action column
// Action column
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{

View File

@ -1482,7 +1482,7 @@ else
$sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
$sql.= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,";
$sql.= " cd.fk_unit,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql.= " WHERE cd.rowid = ".$object->lines[$cursorline-1]->id;
@ -1513,7 +1513,7 @@ else
if ($action != 'editline' || GETPOST('rowid') != $objp->rowid)
{
print '<tr '.$bcnd[$var].' valign="top">';
// Libelle
// Label
if ($objp->fk_product > 0)
{
print '<td>';
@ -1521,19 +1521,21 @@ else
$productstatic->type=$objp->ptype;
$productstatic->ref=$objp->pref;
$productstatic->entity=$objp->pentity;
$text = $productstatic->getNomUrl(1,'',20);
if ($objp->label)
$productstatic->label=$objp->plabel;
$text = $productstatic->getNomUrl(1,'',20);
if ($objp->plabel)
{
$text .= ' - ';
$productstatic->ref=$objp->label;
$text .= $productstatic->getNomUrl(0,'',16);
//$productstatic->ref=$objp->label;
//$text .= $productstatic->getNomUrl(0,'',16);
$text .= $objp->plabel;
}
$description = $objp->description;
// Add description in form
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{
$text .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
$text .= (! empty($objp->description) && $objp->description!=$objp->plabel)?'<br>'.dol_htmlentitiesbr($objp->description):'';
$description = ''; // Already added into main visible desc
}
@ -1543,7 +1545,7 @@ else
}
else
{
print '<td>'.dol_htmlentitiesbr($objp->description)."</td>\n";
print '<td>'.img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description)."</td>\n";
}
// TVA
print '<td align="center">';
@ -2043,7 +2045,7 @@ else
if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid">'.$langs->trans("Validate").'</a></div>';
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Validate").'</a></div>';
}
if ($object->statut == 1 && $nbofservices)
if ($object->statut == 1)
{
if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Modify").'</a></div>';
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Modify").'</a></div>';

View File

@ -1278,7 +1278,7 @@ class Contrat extends CommonObject
//// End call triggers
}
}
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
@ -1831,13 +1831,13 @@ class Contrat extends CommonObject
$text.=': &nbsp; &nbsp; ';
}
$text.=($mode == 7?'<div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? $this->nbofserviceswait.' '.$line->LibStatut(0,3).(($this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.$line->LibStatut(0,3)).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode == 7?'</div><div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofservicesopened > 0) ? $this->nbofservicesopened.' '.$line->LibStatut(4,3,0).(($this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.$line->LibStatut(4,3,0)).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode == 7?'</div><div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofservicesexpired > 0) ? $this->nbofservicesexpired.' '.$line->LibStatut(4,3,1).(($this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.$line->LibStatut(4,3,1)).(($mode != 7 || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode == 7?'</div><div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofservicesclosed > 0) ? $this->nbofservicesclosed.' '.$line->LibStatut(5,3) : '';
$text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.$line->LibStatut(5,3)) : '';
$text.=($mode == 7?'</div>':'');
return $text;
}

View File

@ -544,7 +544,7 @@ if ($resql)
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}

View File

@ -223,7 +223,7 @@ if ($mode == "5") $sql.= " AND cd.statut = 5";
if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'";
if ($filter == "notexpired") $sql.= " AND cd.date_fin_validite >= '".$db->idate($now)."'";
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_contract) $sql.= " AND c.ref LIKE '%".$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;
$filter_dateouvertureprevue=dol_mktime(0,0,0,$opouvertureprevuemonth,$opouvertureprevueday,$opouvertureprevueyear);
@ -374,7 +374,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}

View File

@ -174,7 +174,9 @@ if ($action == 'add')
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
(GETPOST('list', 'alpha')?1:0),
(GETPOST('ishidden', 'alpha')?1:0),
GETPOST('computed_value','alpha')
GETPOST('computed_value','alpha'),
(GETPOST('entitycurrentorall', 'alpha')?0:'')
);
if ($result > 0)
{

View File

@ -91,6 +91,8 @@ if (! $error && $massaction == 'confirm_presend')
}
//var_dump($listofobjectthirdparties);exit;
// Loop on each thirdparty
foreach ($listofobjectthirdparties as $thirdpartyid)
{
$result = $thirdparty->fetch($thirdpartyid);
@ -100,62 +102,90 @@ if (! $error && $massaction == 'confirm_presend')
exit;
}
// Define recipient $sendto and $sendtocc
$sendto='';
$sendtocc='';
$sendtobcc='';
$sendtoid = array();
// Define $sendto
$receiver=$_POST['receiver'];
if (! is_array($receiver))
{
if ($receiver == '-1') $receiver=array();
else $receiver=array($receiver);
}
$tmparray=array();
if (trim($_POST['sendto']))
{
// Recipient is provided into free text
$sendto = trim($_POST['sendto']);
$sendtoid = 0;
// Recipients are provided into free text
$tmparray[] = trim($_POST['sendto']);
}
elseif ($_POST['receiver'] != '-1')
if (count($receiver)>0)
{
// Recipient was provided from combo list
if ($_POST['receiver'] == 'thirdparty') // Id of third party
{
$sendto = $thirdparty->email;
$sendtoid = 0;
}
else // Id du contact
{
$sendto = $thirdparty->contact_get_property((int) $_POST['receiver'],'email');
$sendtoid = $_POST['receiver'];
}
foreach($receiver as $key=>$val)
{
// Recipient was provided from combo list
if ($val == 'thirdparty') // Id of third party
{
$tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>';
}
elseif ($val) // Id du contact
{
$tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
$sendtoid[] = $val;
}
}
}
$sendto=implode(',',$tmparray);
// Define $sendtocc
$receivercc=$_POST['receivercc'];
if (! is_array($receivercc))
{
if ($receivercc == '-1') $receivercc=array();
else $receivercc=array($receivercc);
}
$tmparray=array();
if (trim($_POST['sendtocc']))
{
$sendtocc = trim($_POST['sendtocc']);
$tmparray[] = trim($_POST['sendtocc']);
}
elseif ($_POST['receivercc'] != '-1')
if (count($receivercc) > 0)
{
// 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((int) $_POST['receivercc'],'email');
}
foreach($receivercc as $key=>$val)
{
// Recipient was provided from combo list
if ($val == 'thirdparty') // Id of third party
{
$tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>';
}
elseif ($val) // Id du contact
{
$tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
//$sendtoid[] = $val; TODO Add also id of contact in CC ?
}
}
}
$sendtocc=implode(',',$tmparray);
//var_dump($listofobjectref[$thirdpartyid]); // Array of invoice for this thirdparty
//var_dump($listofobjectref);exit;
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
$listofqualifiedinvoice=array();
$listofqualifiedref=array();
foreach($listofobjectref[$thirdpartyid] as $objectid => $object)
{
//var_dump($object);
//var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut);
if ($objectclass == 'Facture' && $object->statut != Facture::STATUS_VALIDATED)
{
$langs->load("errors");
$nbignored++;
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$object->ref).'</div><br>';
continue; // Payment done or started or canceled
}
if ($objectclass == 'Commande' && $object->statut == Commande::STATUS_DRAFT)
{
$langs->load("errors");
$nbignored++;
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$object->ref).'</div><br>';
continue;
@ -209,6 +239,7 @@ if (! $error && $massaction == 'confirm_presend')
//var_dump($listofqualifiedref);
}
// Loop on each qualified invoice of the thirdparty
if (count($listofqualifiedinvoice) > 0)
{
$langs->load("commercial");

View File

@ -32,7 +32,6 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! isset($mode) || $mode != 'noajax') // For ajax call
{
require_once '../../main.inc.php';
@ -45,6 +44,7 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call
$section=GETPOST("section");
$module=GETPOST("module");
$urlsource=GETPOST("urlsource");
$search_doc_ref=GETPOST('search_doc_ref','alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@ -188,12 +188,16 @@ if ($type == 'directory')
if (in_array($module, $automodules))
{
$param.='&module='.$module;
if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref;
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
if ($module == 'company') $excludefiles[]='^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty.
$filearray=dol_dir_list($upload_dir,"files",1,'', $excludefiles, $sortfield, $sorting,1);
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
$filter=preg_quote($search_doc_ref, '/');
$filearray=dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting,1);
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url,1);
}
// Manual list
else
@ -202,7 +206,7 @@ if ($type == 'directory')
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
// If $section defined with value 0
if ($section === '0')
if ($section === '0' || empty($section))
{
$filearray=array();
}
@ -211,12 +215,14 @@ if ($type == 'directory')
if ($section)
{
$param.='&section='.$section;
if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref;
$textifempty = $langs->trans('NoFileFound');
}
else if ($section === '0') $textifempty='<br><div align="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection"));
$formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname,'',$url);
$formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname,'',$url);
}
}

View File

@ -83,17 +83,17 @@ class box_activity extends ModeleBoxes
$cachetime = 3600;
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache';
$now = dol_now();
$nbofyears=2;
$nbofperiod=3;
if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofyears=$conf->global->MAIN_BOX_ACTIVITY_DURATION;
$textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofyears*12);
if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofperiod=$conf->global->MAIN_BOX_ACTIVITY_DURATION;
$textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofperiod);
$this->info_box_head = array(
'text' => $textHead,
'limit'=> dol_strlen($textHead),
);
// compute the year limit to show
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofyears, "y");
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofperiod, "m");
$cumuldata = array();
@ -103,6 +103,7 @@ class box_activity extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$facturestatic=new Facture($db);
// part 1
$cachedir = DOL_DATA_ROOT.'/facture/temp';
$filename = '/boxactivity-invoice'.$fileid;
@ -189,6 +190,7 @@ class box_activity extends ModeleBoxes
);
}
// part 2
$cachedir = DOL_DATA_ROOT.'/facture/temp';
$filename = '/boxactivity-invoice2'.$fileid;

View File

@ -27,7 +27,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last services lines
* Class to manage the box to show last contracted products/services lines
*/
class box_services_contracts extends ModeleBoxes
{
@ -72,6 +72,8 @@ class box_services_contracts extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$form = new Form($db);
$this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract",$max));
if ($user->rights->service->lire && $user->rights->contrat->lire)
@ -79,11 +81,12 @@ class box_services_contracts extends ModeleBoxes
$contractstatic=new Contrat($db);
$contratlignestatic=new ContratLigne($db);
$thirdpartytmp = new Societe($db);
$productstatic = new Product($db);
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " c.rowid, c.ref, c.statut as contract_status,";
$sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut, cd.label, cd.description, cd.product_type as type,";
$sql.= " p.rowid as product_id, p.ref as product_ref";
$sql.= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as plabel, p.fk_product_type as ptype, p.entity";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
@ -140,8 +143,41 @@ class box_services_contracts extends ModeleBoxes
}
}
// Label
if ($objp->product_id > 0)
{
$productstatic->id=$objp->product_id;
$productstatic->type=$objp->ptype;
$productstatic->ref=$objp->product_ref;
$productstatic->entity=$objp->pentity;
$productstatic->label=$objp->plabel;
$text = $productstatic->getNomUrl(1,'',20);
if ($objp->plabel)
{
$text .= ' - ';
//$productstatic->ref=$objp->label;
//$text .= $productstatic->getNomUrl(0,'',16);
$text .= $objp->plabel;
}
$description = $objp->description;
// Add description in form
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{
//$text .= (! empty($objp->description) && $objp->description!=$objp->plabel)?'<br>'.dol_htmlentitiesbr($objp->description):'';
$description = ''; // Already added into main visible desc
}
$s = $form->textwithtooltip($text,$description,3,'','',$cursorline,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):''));
}
else
{
$s = img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description);
}
$this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
'text' => $contratlignestatic->getNomUrl(1),
'text' => $s,
'asis' => 1
);

View File

@ -5030,57 +5030,6 @@ abstract class CommonObject
}
}
/**
* Load an object from its id and create a new one in database
*
* @param User $user User that creates
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromCloneCommon(User $user, $fromid)
{
global $user, $langs;
$error = 0;
dol_syslog(__METHOD__, LOG_DEBUG);
$object = new self($this->db);
$this->db->begin();
// Load source object
$object->fetchCommon($fromid);
// Reset some properties
unset($object->id);
unset($object->fk_user_creat);
unset($object->import_key);
// Clear fields
$object->ref = "copy_of_".$object->ref;
$object->title = $langs->trans("CopyOf")." ".$object->title;
// ...
// Create clone
$result = $object->createCommon($user);
// Other options
if ($result < 0) {
$error++;
$this->error = $object->error;
$this->errors = $object->errors;
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
}
// End
if (!$error) {
$this->db->commit();
return $object->id;
} else {
$this->db->rollback();
return -1;
}
}
/**
* Load object in memory from the database

View File

@ -172,7 +172,7 @@ class Events // extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."events SET";
$sql.= " type='".$this->db->escape($this->type)."',";
$sql.= " dateevent=".$this->db->idate($this->dateevent).",";
$sql.= " dateevent='".$this->db->idate($this->dateevent)."',";
$sql.= " description='".$this->db->escape($this->description)."'";
$sql.= " WHERE rowid=".$this->id;

View File

@ -139,9 +139,10 @@ class ExtraFields
* @param int $list Into list view by default
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @param string $computed Computed value
* @param string $entity Entity of extrafields
* @return int <=0 if KO, >0 if OK
*/
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0, $perms='', $list=0, $ishidden=0, $computed='')
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0, $perms='', $list=0, $ishidden=0, $computed='', $entity='')
{
if (empty($attrname)) return -1;
if (empty($label)) return -1;
@ -158,7 +159,7 @@ class ExtraFields
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
{
// Add declaration of field into table
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $ishidden, $default, $computed);
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $ishidden, $default, $computed, $entity);
$err2=$this->errno;
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
{
@ -277,9 +278,10 @@ class ExtraFields
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @param string $default Default value (in database. use the default_value feature for default value on screen).
* @param string $computed Computed value
* @param string $entity Entity of extrafields
* @return int <=0 if KO, >0 if OK
*/
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0, $default='', $computed='')
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0, $default='', $computed='',$entity='')
{
global $conf,$user;
@ -331,7 +333,7 @@ class ExtraFields
$sql.= " '".$type."',";
$sql.= " '".$pos."',";
$sql.= " '".$size."',";
$sql.= " ".$conf->entity.",";
$sql.= " ".($entity===''?$conf->entity:$entity).",";
$sql.= " '".$elementtype."',";
$sql.= " '".$unique."',";
$sql.= " '".$required."',";
@ -477,9 +479,10 @@ class ExtraFields
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @param string $default Default value (in database. use the default_value feature for default value on screen).
* @param string $computed Computed value
* @param string $entity Entity of extrafields
* @return int >0 if OK, <=0 if KO
*/
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='',$ishidden=0,$default='',$computed='')
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='',$ishidden=0,$default='',$computed='',$entity='')
{
if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
@ -527,7 +530,7 @@ class ExtraFields
{
if ($label)
{
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$ishidden,$default,$computed);
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$ishidden,$default,$computed,$entity);
}
if ($result > 0)
{
@ -581,12 +584,13 @@ class ExtraFields
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @param string $default Default value (in database. use the default_value feature for default value on screen).
* @param string $computed Computed value
* @param string $entity Entity of extrafields
* @return int <=0 if KO, >0 if OK
*/
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$ishidden=0,$default='',$computed='')
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$ishidden=0,$default='',$computed='',$entity='')
{
global $conf, $user;
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$ishidden.", ".$default.", ".$computed);
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$ishidden.", ".$default.", ".$computed.", ".$entity);
// Clean parameters
if ($elementtype == 'thirdparty') $elementtype='societe';
@ -605,7 +609,7 @@ class ExtraFields
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
$sql_del.= " WHERE name = '".$attrname."'";
$sql_del.= " AND entity = ".$conf->entity;
$sql_del.= " AND entity = ".($entity===''?$conf->entity:$entity);
$sql_del.= " AND elementtype = '".$elementtype."'";
$resql1=$this->db->query($sql_del);
@ -632,7 +636,7 @@ class ExtraFields
$sql.= " datec";
$sql.= ") VALUES (";
$sql.= "'".$attrname."',";
$sql.= " ".$conf->entity.",";
$sql.= " ".($entity===''?$conf->entity:$entity).",";
$sql.= " '".$this->db->escape($label)."',";
$sql.= " '".$type."',";
$sql.= " '".$size."',";
@ -699,6 +703,7 @@ class ExtraFields
dol_syslog("fetch_name_optionals_label elementtype=".$elementtype);
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,list,ishidden,fielddefault,fieldcomputed";
$sql .= ",entity";
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
$sql.= " WHERE entity IN (0,".$conf->entity.")";
if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'";
@ -732,6 +737,7 @@ class ExtraFields
$this->attribute_perms[$tab->name]=$tab->perms;
$this->attribute_list[$tab->name]=$tab->list;
$this->attribute_hidden[$tab->name]=$tab->ishidden;
$this->attribute_entity[$tab->name]=$tab->entity;
// New usage
$this->attributes[$tab->elementtype]['type'][$tab->name]=$tab->type;
@ -748,6 +754,7 @@ class ExtraFields
$this->attributes[$tab->elementtype]['perms'][$tab->name]=$tab->perms;
$this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list;
$this->attributes[$tab->elementtype]['ishidden'][$tab->name]=$tab->ishidden;
$this->attributes[$tab->elementtype]['entity'][$tab->name]=$tab->entity;
}
}
if ($elementtype) $this->attributes[$elementtype]['loaded']=1;

View File

@ -4727,6 +4727,7 @@ class Form
$smin = !isset($conf->global->MAIN_DEFAULT_DATE_MIN) ? '' : $conf->global->MAIN_DEFAULT_DATE_MIN;
}
// You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery'
$usecalendar='combo';
if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) $usecalendar=empty($conf->global->MAIN_POPUP_CALENDAR)?'eldy':$conf->global->MAIN_POPUP_CALENDAR;
if ($conf->browser->phone) $usecalendar='combo';
@ -4758,7 +4759,8 @@ class Form
{
$retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
$base=DOL_URL_ROOT.'/core/';
$retstring.=' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');">'.img_object($langs->trans("SelectDate"),'calendarday','class="datecallink"').'</button>';
$retstring.=' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
$retstring.='>'.img_object($langs->trans("SelectDate"),'calendarday','class="datecallink"').'</button>';
}
else $retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"),'calendarday','class="datecallink"').'</button>';
@ -4766,6 +4768,37 @@ class Form
$retstring.='<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
$retstring.='<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";
}
elseif ($usecalendar == 'jquery')
{
if (! $disabled)
{
print "<script type='text/javascript'>";
print "$(function(){ $('#".$prefix."').datepicker({ dateFormat: '".$langs->trans("FormatDateShortJQueryInput")."', autoclose: true, todayHighlight: true }) });";
print "</script>";
}
// Zone de saisie manuelle de la date
$retstring.='<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidth75" maxlength="11" value="'.$formated_date.'"';
$retstring.=($disabled?' disabled':'');
$retstring.=' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring.='>';
// Icone calendrier
if (! $disabled)
{
//$retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
//$base=DOL_URL_ROOT.'/core/';
//$retstring.=' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
//$retstring.='>';
$retstring.=img_object($langs->trans("SelectDate"),'calendarday','class="datecallink"');
//$retstring.='</button>';
}
else $retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"),'calendarday','class="datecallink"').'</button>';
$retstring.='<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";
$retstring.='<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
$retstring.='<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";
}
else
{
print "Bad value of MAIN_POPUP_CALENDAR";
@ -5890,18 +5923,22 @@ class Form
$object->next_prev_filter.=$hookmanager->resPrint;
}
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
$object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix);
$navurl = $_SERVER["PHP_SELF"];
// Special case for project/task page
if ($paramid == 'project_ref')
$previous_ref = $next_ref = '';
if ($shownav)
{
$navurl = preg_replace('/\/tasks\/(task|contact|time|note|document).php/','/tasks.php',$navurl);
$paramid='ref';
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
$object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix);
$navurl = $_SERVER["PHP_SELF"];
// Special case for project/task page
if ($paramid == 'project_ref')
{
$navurl = preg_replace('/\/tasks\/(task|contact|time|note|document)\.php/','/tasks.php',$navurl);
$paramid='ref';
}
$previous_ref = $object->ref_previous?'<a href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>':'<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
$next_ref = $object->ref_next?'<a href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>':'<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
}
$previous_ref = $object->ref_previous?'<a href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>':'<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
$next_ref = $object->ref_next?'<a href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>':'<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
//print "xx".$previous_ref."x".$next_ref;
$ret.='<!-- Start banner content --><div style="vertical-align: middle">';
@ -5955,6 +5992,10 @@ class Form
{
$ret.=$object->label;
}
else if ($object->element == 'ecm_directories')
{
$ret.='';
}
else if ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref);
@ -6325,5 +6366,175 @@ class Form
}
return $out;
}
/**
* Return HTML to show the select categories of expense category
*
* @param string $selected preselected category
* @param string $htmlname name of HTML select list
* @param integer $useempty 1=Add empty line
* @param array $excludeid id to exclude
* @param string $target htmlname of target select to bind event
* @param int $default_selected default category to select if fk_c_type_fees change = EX_KME
* @param array $params param to give
* @return string
*/
function selectExpenseCategories($selected='', $htmlname='fk_c_exp_tax_cat', $useempty=0, $excludeid=array(), $target='', $default_selected=0, $params=array())
{
global $db,$conf,$langs;
$sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1';
$sql.= ' AND entity IN (0,'.getEntity('').')';
if (!empty($excludeid)) $sql.= ' AND rowid NOT IN ('.implode(',', $excludeid).')';
$sql.= ' ORDER BY label';
$resql = $db->query($sql);
if ($resql)
{
$out = '<select name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
if ($useempty) $out.= '<option value="0"></option>';
while ($obj = $db->fetch_object($resql))
{
$out.= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
}
$out.= '</select>';
if (!empty($target))
{
$sql = "SELECT c.id FROM ".MAIN_DB_PREFIX."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
$resql = $db->query($sql);
if ($resql)
{
if ($db->num_rows($resql) > 0)
{
$obj = $db->fetch_object($resql);
$out.= '<script type="text/javascript">
$(function() {
$("select[name='.$target.']").on("change", function() {
var current_val = $(this).val();
if (current_val == '.$obj->id.') {';
if (!empty($default_selected) || !empty($selected)) $out.= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");';
$out.= '
$("select[name='.$htmlname.']").change();
}
});
$("select[name='.$htmlname.']").change(function() {
if ($("select[name='.$target.']").val() == '.$obj->id.') {
// get price of kilometer to fill the unit price
var data = '.json_encode($params).';
data.fk_c_exp_tax_cat = $(this).val();
$.ajax({
method: "POST",
dataType: "json",
data: data,
url: "'.(DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php').'",
}).done(function( data, textStatus, jqXHR ) {
console.log(data);
if (typeof data.up != "undefined") {
$("input[name=value_unit]").val(data.up);
$("select[name='.$htmlname.']").attr("title", data.title);
} else {
$("input[name=value_unit]").val("");
$("select[name='.$htmlname.']").attr("title", "");
}
});
}
});
});
</script>';
}
}
}
}
else
{
dol_print_error($db);
}
return $out;
}
/**
* Return HTML to show the select ranges of expense range
*
* @param string $selected preselected category
* @param string $htmlname name of HTML select list
* @param integer $useempty 1=Add empty line
* @return string
*/
function selectExpenseRanges($selected='', $htmlname='fk_range', $useempty=0)
{
global $db,$conf,$langs;
$sql = 'SELECT rowid, range_ik FROM '.MAIN_DB_PREFIX.'c_exp_tax_range';
$sql.= ' WHERE entity = '.$conf->entity.' AND active = 1';
$resql = $db->query($sql);
if ($resql)
{
$out = '<select name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
if ($useempty) $out.= '<option value="0"></option>';
while ($obj = $db->fetch_object($resql))
{
$out.= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
}
$out.= '</select>';
}
else
{
dol_print_error($db);
}
return $out;
}
/**
* Return HTML to show a select of expense
*
* @param string $selected preselected category
* @param string $htmlname name of HTML select list
* @param integer $useempty 1=Add empty choice
* @param integer $allchoice 1=Add all choice
* @param integer $useid 0=use 'code' as key, 1=use 'id' as key
* @return string
*/
function selectExpense($selected='', $htmlname='fk_c_type_fees', $useempty=0, $allchoice=1, $useid=0)
{
global $db,$langs;
$sql = 'SELECT id, code, label FROM '.MAIN_DB_PREFIX.'c_type_fees';
$sql.= ' WHERE active = 1';
$resql = $db->query($sql);
if ($resql)
{
$out = '<select name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
if ($useempty) $out.= '<option value="0"></option>';
if ($allchoice) $out.= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>';
$field = 'code';
if ($useid) $field = 'id';
while ($obj = $db->fetch_object($resql))
{
$key = $langs->trans($obj->code);
$out.= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
}
$out.= '</select>';
}
else
{
dol_print_error($db);
}
return $out;
}
}

View File

@ -194,11 +194,11 @@ class FormActions
print '<div class="div-table-responsive">';
print '<table class="noborder'.($morecss?' '.$morecss:'').'" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'), $_SERVER["PHP_SELF"], '', $page, $param, '');
print_liste_field_titre($langs->trans('Action'), $_SERVER["PHP_SELF"], '', $page, $param, '');
print_liste_field_titre($langs->trans('Type'), $_SERVER["PHP_SELF"], '', $page, $param, '');
print_liste_field_titre($langs->trans('Date'), $_SERVER["PHP_SELF"], '', $page, $param, '');
print_liste_field_titre($langs->trans('By'), $_SERVER["PHP_SELF"], '', $page, $param, '');
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], '', $page, $param, '');
print_liste_field_titre('Action', $_SERVER["PHP_SELF"], '', $page, $param, '');
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', $page, $param, '');
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], '', $page, $param, '');
print_liste_field_titre('By', $_SERVER["PHP_SELF"], '', $page, $param, '');
print_liste_field_titre('', $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"');
print '</tr>';
print "\n";

View File

@ -835,9 +835,9 @@ class FormFile
$out='';
$this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array());
//if (! empty($conf->dol_use_jmobile)) return '';
$filterforfilesearch = preg_quote(basename($modulesubdir),'/').'[^\-]+';
$file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files)
$file_list=dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files)
// For ajax treatment
$out.= '<!-- html.formfile::getDocumentsLink -->'."\n";
@ -922,9 +922,10 @@ class FormFile
* @param string $sortfield Sort field ('name', 'size', 'position', ...)
* @param string $sortorder Sort order ('ASC' or 'DESC')
* @param int $disablemove 1=Disable move button, 0=Position move is possible.
* @param int $addfilterfields Add line with filters
* @return int <0 if KO, nb of files shown if OK
*/
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1)
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1, $addfilterfields=0)
{
global $user, $conf, $langs, $hookmanager;
global $bc,$bcdd;
@ -1006,10 +1007,22 @@ class FormFile
print '<div class="div-table-responsive-no-min">';
print '<table width="100%" id="tablelines" class="'.($useinecm?'liste noborder':'liste').'">'."\n";
if (! empty($addfilterfields))
{
print '<tr class="liste_titre nodrag nodrop">';
print '<td><input type="search_doc_ref" value="'.dol_escape_htmltag(GETPOST('search_doc_ref','alpha')).'"></td>';
print '<td></td>';
print '<td></td>';
if (empty($useinecm)) print '<td></td>';
print '<td></td>';
if (! $disablemove) print '<td></td>';
print "</tr>\n";
}
print '<tr class="liste_titre nodrag nodrop">';
print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$url,"date","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('Documents2',$url,"name","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre('Size',$url,"size","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('Date',$url,"date","",$param,'align="center"',$sortfield,$sortorder);
if (empty($useinecm)) print_liste_field_titre('',$url,"","",$param,'align="center"');
print_liste_field_titre('');
if (! $disablemove) print_liste_field_titre('');
@ -1291,28 +1304,54 @@ class FormFile
* @param int $useinecm Change output for use in ecm module
* @param int $textifempty Text to show if filearray is empty
* @param int $maxlength Maximum length of file name shown
* @param string $url Full url to use for click links ('' = autodetect)
* @param string $url Full url to use for click links ('' = autodetect)
* @param int $addfilterfields Add line with filters
* @return int <0 if KO, nb of files shown if OK
*/
function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$url='')
function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$url='',$addfilterfields=0)
{
global $user, $conf, $langs;
global $user, $conf, $langs, $form;
global $bc;
global $sortfield, $sortorder;
global $search_doc_ref;
dol_syslog(get_class($this).'::list_of_autoecmfiles upload_dir='.$upload_dir.' modulepart='.$modulepart);
// Show list of documents
if (empty($useinecm)) print load_fiche_titre($langs->trans("AttachedFiles"));
if (empty($url)) $url=$_SERVER["PHP_SELF"];
if (! empty($addfilterfields))
{
print '<form action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="module" value="'.$modulepart.'">';
}
print '<div class="div-table-responsive-no-min">';
print '<table width="100%" class="noborder">'."\n";
if (! empty($addfilterfields))
{
print '<tr class="liste_titre nodrag nodrop">';
print '<td><input type="text" class="maxwidth100onsmartphone" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
// Action column
print '<td class="liste_titre" align="middle">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_titre">';
$sortref="fullname";
if ($modulepart == 'invoice_supplier') $sortref='level1name';
print_liste_field_titre($langs->trans("Ref"),$url,$sortref,"",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$url,"date","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$url,$sortref,"",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Documents2",$url,"name","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Size",$url,"size","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Date",$url,"date","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('','','');
print '</tr>'."\n";
@ -1404,20 +1443,20 @@ class FormFile
$id=0; $ref=''; $label='';
// To show ref or specific information according to view to show (defined by $module)
if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices
if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices
if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');}
if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');}
if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');}
if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');}
if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');}
if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');}
if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');}
if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');}
if (! $id && ! $ref) continue;
$found=0;
@ -1449,20 +1488,23 @@ class FormFile
if (! $found > 0 || ! is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) continue; // We do not show orphelins files
print '<!-- Line list_of_autoecmfiles '.$key.' -->'."\n";
print '<tr class="oddeven">';
print '<td>';
if ($found > 0 && is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) print $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]->getNomUrl(1,'document');
else print $langs->trans("ObjectDeleted",($id?$id:$ref));
$filename=dol_sanitizeFileName($ref);
//$modulesubdir=dol_sanitizeFileName($ref);
$modulesubdir=dirname($relativefile);
//$filedir=$conf->$modulepart->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$file['path'];
//$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
//print $formfile->getDocumentsLink($modulepart, $filename, $filedir);
print '</td>';
// File
print '<td>';
//print "XX".$file['name']; //$file['name'] must be utf8
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
@ -1472,7 +1514,7 @@ class FormFile
print dol_trunc($file['name'],$maxlength,'middle');
print '</a>';
print $this->getDocumentsLink($modulepart, $filename, $filedir);
print $this->getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$');
print "</td>\n";
print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>';
@ -1490,12 +1532,15 @@ class FormFile
if (count($filearray) == 0)
{
print '<tr '.$bc[false].'><td colspan="4">';
print '<tr '.$bc[false].'><td colspan="5">';
if (empty($textifempty)) print $langs->trans("NoFileFound");
else print $textifempty;
print '</td></tr>';
}
print "</table>";
print '</div>';
if (! empty($addfilterfields)) print '</form>';
// Fin de zone
}

View File

@ -120,7 +120,7 @@ class Interfaces
if (! $qualified)
{
dol_syslog(get_class($this)."::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled", LOG_DEBUG);
//dol_syslog(get_class($this)."::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled", LOG_DEBUG);
continue;
}
@ -325,8 +325,9 @@ class Interfaces
{
$module=preg_replace('/^mod/i','',$reg[2]);
$constparam='MAIN_MODULE_'.strtoupper($module);
if (strtolower($reg[2]) == 'all') $disabledbymodule=0;
if (strtolower($module) == 'all') $disabledbymodule=0;
else if (empty($conf->global->$constparam)) $disabledbymodule=2;
$triggers[$j]['module']=strtolower($module);
}
// We set info of modules

View File

@ -0,0 +1,60 @@
<?php
if (empty($keyforclass) || empty($keyforclassfile) || empty($keyforelement))
{
//print $keyforclass.' - '.$keyforclassfile.' - '.$keyforelement;
dol_print_error('', 'include of file commonfieldsinexport.inc.php was done but var $keyforclass or $keyforclassfile or $keyforelement was not set');
exit;
}
dol_include_once($keyforclassfile);
if (class_exists($keyforclass))
{
$tmpobject=new $keyforclass($this->db);
// Add common fields
foreach($tmpobject->fields as $keyfield => $valuefield)
{
$fieldname = 't' . '.' . $keyfield;
$fieldlabel = ucfirst($valuefield['label']);
$typeFilter = "Text";
$typefield=preg_replace('/\(.*$/', '', $valuefield['type']); // double(24,8) -> double
switch ($typefield) {
case 'int':
case 'integer':
case 'double':
case 'price':
$typeFilter = "Numeric";
break;
case 'date':
case 'datetime':
case 'timestamp':
$typeFilter = "Date";
break;
case 'boolean':
$typeFilter = "Boolean";
break;
/*
* case 'sellist':
* $tmp='';
* $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
* if ($tmpparam['options'] && is_array($tmpparam['options'])) {
* $tmpkeys=array_keys($tmpparam['options']);
* $tmp=array_shift($tmpkeys);
* }
* if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
* break;
*/
}
if ($valuefield['enabled']) {
$this->export_fields_array[$r][$fieldname] = $fieldlabel;
$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
$this->export_entities_array[$r][$fieldname] = $keyforelement;
}
}
}
else
{
dol_print_error($this->db, 'Failed to find class '.$keyforclass.', even after the include of '.$keyforclassfile);
}
// End add common fields

View File

@ -18,15 +18,17 @@ if ($resql) // This can fail when class is used on old database (during migra
$fieldname=$keyforaliasextra.'.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
$typefield=preg_replace('/\(.*$/', '', $obj->type); // double(24,8) -> double
switch ($typefield) {
case 'int':
case 'integer':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
case 'timestamp':
$typeFilter="Date";
break;
case 'boolean':

View File

@ -46,6 +46,12 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
{
if (empty($minLength)) $minLength=1;
$dataforrenderITem='ui-autocomplete';
$dataforitem='ui-autocomplete-item';
// Allow two constant to use other values for backward compatibility
if (defined('JS_QUERY_AUTOCOMPLETE_RENDERITEM')) $dataforrenderITem=constant('JS_QUERY_AUTOCOMPLETE_RENDERITEM');
if (defined('JS_QUERY_AUTOCOMPLETE_ITEM')) $dataforitem=constant('JS_QUERY_AUTOCOMPLETE_ITEM');
// Input search_htmlname is original field
// Input htmlname is a second input field used when using ajax autocomplete.
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
@ -185,10 +191,10 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
}
,delay: 500
}).data("ui-autocomplete")._renderItem = function( ul, item ) {
}).data("'.$dataforrenderITem.'")._renderItem = function( ul, item ) {
return $("<li>")
.data( "ui-autocomplete-item", item ) // jQuery UI > 1.10.0
.data( "'.$dataforitem.'", item ) // jQuery UI > 1.10.0
.append( \'<a><span class="tag">\' + item.label + "</span></a>" )
.appendTo(ul);
};

View File

@ -749,10 +749,10 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$colspan=9;
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Poste"),$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Poste",$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
print_liste_field_titre( $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder);
// Add to agenda
if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create))
{

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -419,7 +420,7 @@ function dol_get_next_week($day, $week, $month, $year)
{
$tmparray = dol_get_first_day_week($day, $month, $year);
$time=dol_mktime(12,0,0,$month,$tmparray['first_day'],$year,1,0);
$time=dol_mktime(12,0,0,$tmparray['first_month'],$tmparray['first_day'],$tmparray['first_year'],1,0);
$time+=24*60*60*7;
$tmparray=dol_getdate($time,true);

View File

@ -132,6 +132,22 @@ function expensereport_admin_prepare_head()
$head[$h][2] = 'expensereport';
$h++;
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
{
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_ik.php";
$head[$h][1] = $langs->trans("ExpenseReportsIk");
$head[$h][2] = 'expenseik';
$h++;
}
if (!empty($conf->global->MAIN_USE_EXPENSE_RULE))
{
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_rules.php";
$head[$h][1] = $langs->trans("ExpenseReportsRules");
$head[$h][2] = 'expenserules';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

Some files were not shown because too many files have changed in this diff Show More