Merge branch '6.0' of https://github.com/Dolibarr/dolibarr.git into 6.0_bug3

This commit is contained in:
Regis Houssin 2017-09-09 12:14:22 +02:00
commit db02c32a9f
21 changed files with 338 additions and 197 deletions

View File

@ -213,8 +213,8 @@ for($i = 1; $i <= 12; $i ++) {
}
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
@ -240,8 +240,20 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind')
{
print $langs->trans("Unknown");
}
else print length_accountg($row[0]);
print '</td>';
print '<td align="left">';
if ($row[0] == 'tobind')
{
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
}
else print $row[1];
print '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';
}
@ -269,8 +281,8 @@ for($i = 1; $i <= 12; $i ++) {
}
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
@ -296,7 +308,20 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind')
{
print $langs->trans("Unknown");
}
else print length_accountg($row[0]);
print '</td>';
print '<td align="left">';
if ($row[0] == 'tobind')
{
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
}
else print $row[1];
print '</td>';
print '<td align="left">' . $row[1] . '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';
@ -363,7 +388,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
}
print "</table>\n";
if (! empty($conf->margin->enabled)) {
print "<br>\n";
print '<table class="noborder" width="100%">';

View File

@ -94,7 +94,7 @@ if ($action == 'validatehistory') {
}
dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
@ -139,7 +139,7 @@ if ($action == 'validatehistory') {
$sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
$sql1.=")";
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1);
@ -194,8 +194,8 @@ for($i = 1; $i <= 12; $i ++) {
}
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
@ -217,9 +217,21 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind')
{
print $langs->trans("Unknown");
}
else print length_accountg($row[0]);
print '</td>';
print '<td align="left">';
if ($row[0] == 'tobind')
{
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
}
else print $row[1];
print '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';
}
print '<td align="right">' . price($row[13]) . '</td>';
@ -247,8 +259,8 @@ for($i = 1; $i <= 12; $i ++) {
}
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
@ -270,9 +282,21 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind')
{
print $langs->trans("Unknown");
}
else print length_accountg($row[0]);
print '</td>';
print '<td align="left">';
if ($row[0] == 'tobind')
{
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
}
else print $row[1];
print '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';
}
print '<td align="right">' . price($row[13]) . '</td>';
@ -292,9 +316,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
{
print '<br>';
print '<br>';
print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n";
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
@ -302,7 +326,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
}
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT '" . $langs->trans("TotalExpenseReport") . "' AS label,";
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
@ -314,12 +338,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= " AND er.fk_statut > 0 ";
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
while ( $row = $db->fetch_row($resql)) {
print '<tr><td>' . $row[0] . '</td>';
for($i = 1; $i <= 12; $i ++) {
@ -328,7 +352,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error

View File

@ -104,12 +104,15 @@ $idpays = $mysoc->country_id;
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop,";
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop";
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop_company,";
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop_user,";
$sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
$sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
@ -147,6 +150,7 @@ $result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
//print $sql;
// Variables
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
@ -172,13 +176,31 @@ if ($result) {
{
$obj = $db->fetch_object($result);
// Set accountancy code (for bank and thirdparty)
$lineisapurchase = -1;
$lineisasale = -1;
// Old method to detect if it's a sale or purchase
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase=1;
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale=1;
// Try a more reliable method to detect if record is a supplier payment or a customer payment
if ($lineisapurchase < 0)
{
if ($obj->typeop_payment_supplier == 'payment_supplier') $lineisapurchase = 1;
}
if ($lineisasale < 0)
{
if ($obj->typeop_payment == 'payment') $lineisasale = 1;
}
//var_dump($obj->type_payment); var_dump($obj->type_payment_supplier);
//var_dump($lineisapurchase); //var_dump($lineisasale);
// Set accountancy code for bank
$compta_bank = $obj->account_number;
// Set accountancy code for thirdparty
$compta_soc = 'NotDefined';
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)')
if ($lineisapurchase > 0)
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)')
if ($lineisasale > 0)
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
$tabcompany[$obj->rowid] = array (
@ -187,6 +209,7 @@ if ($result) {
'code_compta' => $compta_soc,
);
// Set accountancy code for user
$compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
$tabuser[$obj->rowid] = array (
@ -202,6 +225,7 @@ if ($result) {
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
$tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
@ -214,7 +238,7 @@ if ($result) {
//var_dump($tabpay);
// By default
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or old record with no links in bank_url.
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
$tabtype[$obj->rowid] = 'unknown';
// get_url may return -1 which is not traversable
@ -604,6 +628,8 @@ if (! $error && $action == 'writebookkeeping') {
}
}
// Export
if ($action == 'exportcsv') { // ISO and not UTF8 !
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
@ -737,6 +763,22 @@ if (empty($action) || $action == 'view') {
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
// Test that setup is complete
$sql='SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE fk_accountancy_journal IS NULL';
$resql=$db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
if ($obj->nb > 0)
{
print img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>');
}
}
else dol_print_error($db);
// Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
@ -797,8 +839,10 @@ if (empty($action) || $action == 'view') {
// Bank
foreach ( $tabbq[$key] as $k => $mt )
{
//var_dump($tabpay[$key]);
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
print '<tr class="oddeven">';
print "<td><!-- Bank bank.rowid=".$key."--></td>";
print "<td></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
@ -819,11 +863,14 @@ if (empty($action) || $action == 'view') {
}
else print $accounttoshow;*/
print "</td>";
if ($val['soclib'] == '') {
print "<td>" . $langs->trans("Bank") . " - " . $reflabel . "</td>";
} else {
print "<td>" . $langs->trans("Bank") . " - " . $val['soclib'] . "</td>";
print "<td>";
//var_dump($tabpay[$key]);
print $langs->trans("Bank");
print ' '.$val['bank_account_ref'];
if (! empty($val['soclib'])) {
print " - " . $val['soclib'];
}
print "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
@ -834,14 +881,15 @@ if (empty($action) || $action == 'view') {
if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) {
if ($k != 'type') {
print '<!-- Thirdparty bank.rowid='.$key.' -->';
print '<tr class="oddeven">';
print "<td><!-- Thirdparty bank.rowid=".$key." --></td>";
print "<td></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
$account_ledger = $k;
// Try to force general ledger account depending on type
if ($tabtype[$key] == 'payment') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
if ($tabtype[$key] == 'payment_supplier') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
if ($tabtype[$key] == 'payment_expensereport') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
@ -878,7 +926,11 @@ if (empty($action) || $action == 'view') {
{
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
{
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
/*var_dump($tabpay[$key]);
var_dump($tabtype[$key]);
var_dump($tabbq[$key]);*/
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown").'</span>';
}
else print $accounttoshowsubledger;
}
@ -893,8 +945,9 @@ if (empty($action) || $action == 'view') {
}
} else {
foreach ( $tabbq[$key] as $k => $mt ) {
print '<!-- Wait bank.rowid='.$key.' -->';
print '<tr class="oddeven">';
print "<td><!-- Wait bank.rowid=".$key." --></td>";
print "<td></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
@ -936,7 +989,7 @@ $db->close();
* Return source for doc_ref of a bank transaction
*
* @param string $val Array of val
* @param string $typerecord Type of record
* @param string $typerecord Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...)
* @return string|unknown
*/
function getSourceDocRef($val, $typerecord)

View File

@ -190,8 +190,8 @@ for($i = 1; $i <= 12; $i ++) {
}
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
@ -213,8 +213,20 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind')
{
print $langs->trans("Unknown");
}
else print length_accountg($row[0]);
print '</td>';
print '<td align="left">';
if ($row[0] == 'tobind')
{
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
}
else print $row[1];
print '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';
}
@ -244,8 +256,8 @@ for($i = 1; $i <= 12; $i ++) {
}
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
@ -267,9 +279,21 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind')
{
print $langs->trans("Unknown");
}
else print length_accountg($row[0]);
print '</td>';
print '<td align="left">';
if ($row[0] == 'tobind')
{
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
}
else print $row[1];
print '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';
}
print '<td align="right">' . price($row[13]) . '</td>';

View File

@ -390,13 +390,13 @@ if ($rowid > 0)
}
if ($status != '')
{
$sql.= " AND d.statut IN (".$status.")"; // Peut valoir un nombre ou liste de nombre separes par virgules
$sql.= " AND d.statut IN (".$db->escape($status).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
}
if ($action == 'search')
{
if (GETPOST('search'))
{
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search'));
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
}
}
if (! empty($search_lastname))

View File

@ -1540,17 +1540,30 @@ class Categorie extends CommonObject
dol_mkdir($dir);
}
if (file_exists($dir))
{
$originImage = $dir . $file['name'];
if (file_exists($dir)) {
if (is_array($file['name']) && count($file['name']) > 0) {
for($i = 0; $i <= count($file['name']); $i ++) {
// Cree fichier en taille origine
dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);
$originImage = $dir . $file['name'][$i];
if (file_exists($originImage))
{
// Create thumbs
$this->addThumbs($originImage);
// Cree fichier en taille origine
dol_move_uploaded_file($file['tmp_name'][$i], $originImage, 1, 0, 0);
if (file_exists($originImage)) {
// Create thumbs
$this->addThumbs($originImage);
}
}
} else {
$originImage = $dir . $file['name'];
// Cree fichier en taille origine
dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);
if (file_exists($originImage)) {
// Create thumbs
$this->addThumbs($originImage);
}
}
}
}

View File

@ -640,16 +640,16 @@ class AdvanceTargetingMailing extends CommonObject
$sqlwhere[]=$this->transformToSQL('t.firstname',$arrayquery['contact_firstname']);
}
if (!empty($arrayquery['contact_country']) && count($arrayquery['contact_country'])) {
$sqlwhere[]= " (t.fk_pays IN (".implode(',',$arrayquery['contact_country'])."))";
$sqlwhere[]= " (t.fk_pays IN (".$db->escape(implode(',',$arrayquery['contact_country']))."))";
}
if (!empty($arrayquery['contact_status']) && count($arrayquery['contact_status'])>0) {
$sqlwhere[]= " (t.statut IN (".implode(',',$arrayquery['contact_status'])."))";
$sqlwhere[]= " (t.statut IN (".$db->escape(implode(',',$arrayquery['contact_status']))."))";
}
if (!empty($arrayquery['contact_civility']) && count($arrayquery['contact_civility'])>0) {
$sqlwhere[]= " (t.civility IN ('".implode("','",$arrayquery['contact_civility'])."'))";
$sqlwhere[]= " (t.civility IN ('".$db->escape(implode("','",$arrayquery['contact_civility']))."'))";
}
if ($arrayquery['contact_no_email']!='') {
$sqlwhere[]= " (t.no_email='".$arrayquery['contact_no_email']."')";
$sqlwhere[]= " (t.no_email='".$db->escape($arrayquery['contact_no_email'])."')";
}
if ($arrayquery['contact_update_st_dt']!='') {
$sqlwhere[]= " (t.tms >= '".$this->db->idate($arrayquery['contact_update_st_dt'])."' AND t.tms <= '".$this->db->idate($arrayquery['contact_update_end_dt'])."')";
@ -658,7 +658,7 @@ class AdvanceTargetingMailing extends CommonObject
$sqlwhere[]= " (t.datec >= '".$this->db->idate($arrayquery['contact_create_st_dt'])."' AND t.datec <= '".$this->db->idate($arrayquery['contact_create_end_dt'])."')";
}
if (!empty($arrayquery['contact_categ']) && count($arrayquery['contact_categ'])>0) {
$sqlwhere[]= " (contactcateg.fk_categorie IN (".implode(",",$arrayquery['contact_categ'])."))";
$sqlwhere[]= " (contactcateg.fk_categorie IN (".$db->escape(implode(",",$arrayquery['contact_categ']))."))";
}
//Standard Extrafield feature

View File

@ -92,7 +92,7 @@ dol_mkdir($dir);
$stats = new PropaleStats($db, $socid, ($userid>0?$userid:0), $mode);
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND p.fk_statut IN ('.$object_status.')';
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND p.fk_statut IN ('.$db->escape($object_status).')';
// Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
@ -299,7 +299,7 @@ foreach ($data as $val)
while (! empty($year) && $oldyear > $year+1)
{ // If we have empty year
$oldyear--;
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>';

View File

@ -88,11 +88,11 @@ dol_mkdir($dir);
$stats = new CommandeStats($db, $socid, $mode, ($userid>0?$userid:0));
if ($mode == 'customer')
{
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')';
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND c.fk_statut IN ('.$db->escape($object_status).')';
}
if ($mode == 'supplier')
{
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')';
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND c.fk_statut IN ('.$db->escape($object_status).')';
}

View File

@ -84,11 +84,11 @@ dol_mkdir($dir);
$stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0));
if ($mode == 'customer')
{
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')';
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
}
if ($mode == 'supplier')
{
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')';
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
}
// Build graphic number of object
@ -299,7 +299,7 @@ foreach ($data as $val)
while ($year && $oldyear > $year+1)
{ // If we have empty year
$oldyear--;
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>';
@ -310,7 +310,7 @@ foreach ($data as $val)
print '<td align="right"></td>';
print '</tr>';
}
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>';

View File

@ -1918,7 +1918,7 @@ class Form
$sql.= ' WHERE p.entity IN ('.getEntity('product').')';
if (count($warehouseStatusArray))
{
$sql.= ' AND (p.fk_product_type = 1 OR e.statut IN ('.implode(',',$warehouseStatusArray).'))';
$sql.= ' AND (p.fk_product_type = 1 OR e.statut IN ('.$db->escape(implode(',',$warehouseStatusArray)).'))';
}
if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {

View File

@ -49,7 +49,7 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
public function isActive()
{
global $conf;
// This function does not exists on some ISP (Ex: Free in France)
if (!function_exists('openlog')) return 0;
@ -81,15 +81,15 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
*/
public function checkConfiguration()
{
global $langs;
global $conf, $langs;
$errors = array();
$facility = SYSLOG_FACILITY;
$facility = constant($conf->global->SYSLOG_FACILITY);
if ($facility)
{
// Only LOG_USER supported on Windows
if (! empty($_SERVER["WINDIR"])) $facility='LOG_USER';
if (! empty($_SERVER["WINDIR"])) $facility=constant('LOG_USER');
dol_syslog("admin/syslog: facility ".$facility);
}

View File

@ -92,11 +92,11 @@ $sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p
$sql.= " ON p.rowid = d.fk_projet WHERE 1 = 1";
if ($statut != '' && $statut != '-1')
{
$sql .= " AND d.fk_statut IN (".$statut.")";
$sql .= " AND d.fk_statut IN (".$db->escape($statut).")";
}
if (trim($search_ref) != '')
{
$sql.= natural_search('d.ref',$search_ref);
$sql.= natural_search('d.ref', $search_ref);
}
if (trim($search_all) != '')
{

View File

@ -74,7 +74,7 @@ print load_fiche_titre($title, $mesg);
dol_mkdir($dir);
$stats = new ExpenseReportStats($db, $socid, $userid);
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND e.fk_statut IN ('.$object_status.')';
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND e.fk_statut IN ('.$db->escape($object_status).')';
// Build graphic number of object
// $data = array(array('Lib',val1,val2,val3),...)
@ -262,7 +262,7 @@ foreach ($data as $val)
while ($year && $oldyear > $year+1)
{ // If we have empty year
$oldyear--;
print '<tr '.$bc[$var].' height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>';
@ -271,7 +271,7 @@ foreach ($data as $val)
print '</tr>';
}
print '<tr '.$bc[$var].' height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>';

View File

@ -75,7 +75,7 @@ print load_fiche_titre($title,'','title_commercial.png');
dol_mkdir($dir);
$stats = new FichinterStats($db, $socid, $mode, ($userid>0?$userid:0));
if ($object_status != '' && $object_status > -1) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')';
if ($object_status != '' && $object_status > -1) $stats->where .= ' AND c.fk_statut IN ('.$db->escape($object_status).')';
// Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
@ -291,7 +291,7 @@ foreach ($data as $val)
while (! empty($year) && $oldyear > $year+1)
{ // If we have empty year
$oldyear--;
print '<tr '.$bc[$var].' height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
@ -304,7 +304,7 @@ foreach ($data as $val)
print '</tr>';
}
print '<tr '.$bc[$var].' height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>';

View File

@ -535,9 +535,9 @@ if ($search_request_author) $sql.=natural_search(array('u.lastname','u.firstname
if ($billed != '' && $billed >= 0) $sql .= " AND cf.billed = ".$billed;
//Required triple check because statut=0 means draft filter
if (GETPOST('statut', 'alpha') !== '')
if (GETPOST('statut', 'intcomma') !== '')
{
$sql .= " AND cf.fk_statut IN (".$db->escape(GETPOST('statut', 'alpha')).")";
$sql .= " AND cf.fk_statut IN (".$db->escape($db->escape(GETPOST('statut', 'intcomma'))).")";
}
if ($search_status != '' && $search_status >= 0)
{

View File

@ -54,7 +54,7 @@ AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for speci
AccountancyAreaDescDonation=STEP %s: Define default accounting accounts for donation. For this, use the menu entry %s.
AccountancyAreaDescMisc=STEP %s: Define mandatory default account and default accounting accounts for miscellaneous transactions. For this, use the menu entry %s.
AccountancyAreaDescLoan=STEP %s: Define default accounting accounts for loans. For this, use the menu entry %s.
AccountancyAreaDescBank=STEP %s: Define accounting accounts for each bank and financial accounts. For this, go on the card of each financial account. You can start from page %s.
AccountancyAreaDescBank=STEP %s: Define accounting accounts and journal code for each bank and financial accounts. For this, go on the card of each financial account. You can start from page %s.
AccountancyAreaDescProd=STEP %s: Define accounting accounts on your products/services. For this, use the menu entry %s.
AccountancyAreaDescBind=STEP %s: Check the binding between existing %s lines and accounting account is done, so application will be able to journalize transactions in Ledger in one click. Complete missing bindings. For this, use the menu entry %s.
@ -63,6 +63,7 @@ AccountancyAreaDescAnalyze=STEP %s: Add or edit existing transactions and genera
AccountancyAreaDescClosePeriod=STEP %s: Close period so we can't make modification in a future.
TheJournalCodeIsNotDefinedOnSomeBankAccount=A mandatory step in setup was not complete (accountancy code journal not defined for all bank accounts)
MenuAccountancy=Accountancy
Selectchartofaccounts=Select active chart of accounts
ChangeAndLoad=Change and load
@ -273,5 +274,6 @@ BookeppingLineAlreayExists=Lines already existing into bookeeping
NoJournalDefined=No journal defined
Binded=Lines bound
ToBind=Lines to bind
UseMenuToSetBindindManualy=Autodection not possible, use menu <a href="%s">%s</a> to make the binding manually
WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manualy in the Ledger. It will be replaced by a more complete report in a next version.

View File

@ -57,7 +57,7 @@ class FormProduct
* @param string $batch Add quantity of batch stock in label for product with batch name batch, batch name precedes batch_id. Nothing if ''.
* @param string $status warehouse status filter, following comma separated filter options can be used
* 'warehouseopen' = select products from open warehouses,
* 'warehouseclosed' = select products from closed warehouses,
* 'warehouseclosed' = select products from closed warehouses,
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
* @param boolean $sumStock sum total stock of a warehouse, default true
* @param array $exclude warehouses ids to exclude
@ -68,28 +68,28 @@ class FormProduct
global $conf, $langs;
if (empty($fk_product) && count($this->cache_warehouses)) return 0; // Cache already loaded and we do not want a list with information specific to a product
if (is_array($exclude)) $excludeGroups = implode("','",$exclude);
$warehouseStatus = array();
if (preg_match('/warehouseclosed/', $status))
if (preg_match('/warehouseclosed/', $status))
{
$warehouseStatus[] = Entrepot::STATUS_CLOSED;
}
if (preg_match('/warehouseopen/', $status))
if (preg_match('/warehouseopen/', $status))
{
$warehouseStatus[] = Entrepot::STATUS_OPEN_ALL;
}
if (preg_match('/warehouseinternal/', $status))
if (preg_match('/warehouseinternal/', $status))
{
$warehouseStatus[] = Entrepot::STATUS_OPEN_INTERNAL;
}
$sql = "SELECT e.rowid, e.label, e.description, e.fk_parent";
if (!empty($fk_product))
if (!empty($fk_product))
{
if (!empty($batch))
if (!empty($batch))
{
$sql.= ", pb.qty as stock";
}
@ -107,7 +107,7 @@ class FormProduct
if (!empty($fk_product))
{
$sql.= " AND ps.fk_product = '".$fk_product."'";
if (!empty($batch))
if (!empty($batch))
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb on pb.fk_product_stock = ps.rowid AND pb.batch = '".$batch."'";
}
@ -115,15 +115,15 @@ class FormProduct
$sql.= " WHERE e.entity IN (".getEntity('stock').")";
if (count($warehouseStatus))
{
$sql.= " AND e.statut IN (".implode(',',$warehouseStatus).")";
$sql.= " AND e.statut IN (".$db->escape(implode(',',$warehouseStatus)).")";
}
else
{
$sql.= " AND e.statut = 1";
}
if(!empty($exclude)) $sql.= ' AND e.rowid NOT IN('.implode(',', $exclude).')';
if(!empty($exclude)) $sql.= ' AND e.rowid NOT IN('.$db->escape(implode(',', $exclude)).')';
if ($sumStock && empty($fk_product)) $sql.= " GROUP BY e.rowid, e.label, e.description, e.fk_parent";
$sql.= " ORDER BY e.label";
@ -144,7 +144,7 @@ class FormProduct
$this->cache_warehouses[$obj->rowid]['stock'] = $obj->stock;
$i++;
}
// Full label init
foreach($this->cache_warehouses as $obj_rowid=>$tab) {
$this->cache_warehouses[$obj_rowid]['full_label'] = $this->get_parent_path($tab);
@ -158,18 +158,18 @@ class FormProduct
return -1;
}
}
/**
* Return full path to current warehouse in $tab (recursive function)
*
*
* @param array $tab warehouse data in $this->cache_warehouses line
* @param String $final_label full label with all parents, separated by ' >> ' (completed on each call)
* @return String full label with all parents, separated by ' >> '
*/
private function get_parent_path($tab, $final_label='') {
if(empty($final_label)) $final_label = $tab['label'];
if(empty($tab['parent_id'])) return $final_label;
else {
if(!empty($this->cache_warehouses[$tab['parent_id']])) {
@ -177,9 +177,9 @@ class FormProduct
return $this->get_parent_path($this->cache_warehouses[$tab['parent_id']], $final_label);
}
}
return $final_label;
}
/**
@ -189,7 +189,7 @@ class FormProduct
* @param string $htmlname Name of html select html
* @param string $filterstatus warehouse status filter, following comma separated filter options can be used
* 'warehouseopen' = select products from open warehouses,
* 'warehouseclosed' = select products from closed warehouses,
* 'warehouseclosed' = select products from closed warehouses,
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
* @param int $empty 1=Can be empty, 0 if not
* @param int $disabled 1=Select is disabled
@ -208,7 +208,7 @@ class FormProduct
global $conf,$langs,$user;
dol_syslog(get_class($this)."::selectWarehouses $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $empty_label, $showstock, $forcecombo, $morecss",LOG_DEBUG);
$out='';
if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = '';
$this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude);
@ -221,7 +221,7 @@ class FormProduct
$out.= $comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
}
$out.='<select class="flat'.($morecss?' '.$morecss:'').'"'.($disabled?' disabled':'').' id="'.$htmlname.'" name="'.($htmlname.($disabled?'_disabled':'')).'"'.$nodatarole.'>';
if ($empty) $out.='<option value="-1">'.($empty_label?$empty_label:'&nbsp;').'</option>';
foreach($this->cache_warehouses as $id => $arraytypes)

View File

@ -3750,7 +3750,7 @@ class Product extends CommonObject
$sql.= " WHERE w.entity IN (".getEntity('stock').")";
$sql.= " AND w.rowid = ps.fk_entrepot";
$sql.= " AND ps.fk_product = ".$this->id;
if ($conf->global->ENTREPOT_EXTRA_STATUS && count($warehouseStatus)) $sql.= " AND w.statut IN (".implode(',',$warehouseStatus).")";
if ($conf->global->ENTREPOT_EXTRA_STATUS && count($warehouseStatus)) $sql.= " AND w.statut IN (".$db->escape(implode(',',$warehouseStatus)).")";
dol_syslog(get_class($this)."::load_stock", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -208,63 +208,63 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Did we click on purge search criteria ?
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_nom='';
$search_alias='';
$search_categ_cus=0;
$search_categ_sup=0;
$search_sale='';
$search_barcode="";
$search_customer_code='';
$search_supplier_code='';
$search_account_customer_code='';
$search_account_supplier_code='';
$search_town="";
$search_zip="";
$search_state="";
$search_country='';
$search_email='';
$search_phone='';
$search_url='';
$search_idprof1='';
$search_idprof2='';
$search_idprof3='';
$search_idprof4='';
$search_idprof5='';
$search_idprof6='';
$search_type='';
$search_type_thirdparty='';
$search_status=-1;
$search_stcomm='';
$search_level_from='';
$search_level_to='';
$toselect='';
$search_array_options=array();
}
// Did we click on purge search criteria ?
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_nom='';
$search_alias='';
$search_categ_cus=0;
$search_categ_sup=0;
$search_sale='';
$search_barcode="";
$search_customer_code='';
$search_supplier_code='';
$search_account_customer_code='';
$search_account_supplier_code='';
$search_town="";
$search_zip="";
$search_state="";
$search_country='';
$search_email='';
$search_phone='';
$search_url='';
$search_idprof1='';
$search_idprof2='';
$search_idprof3='';
$search_idprof4='';
$search_idprof5='';
$search_idprof6='';
$search_type='';
$search_type_thirdparty='';
$search_status=-1;
$search_stcomm='';
$search_level_from='';
$search_level_to='';
$toselect='';
$search_array_options=array();
}
// Mass actions
$objectclass='Societe';
$objectlabel='ThirdParty';
$permtoread = $user->rights->societe->lire;
$permtodelete = $user->rights->societe->supprimer;
$uploaddir = $conf->societe->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
// Mass actions
$objectclass='Societe';
$objectlabel='ThirdParty';
$permtoread = $user->rights->societe->lire;
$permtodelete = $user->rights->societe->supprimer;
$uploaddir = $conf->societe->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($action == 'setstcomm')
{
$object = new Client($db);
$result=$object->fetch(GETPOST('stcommsocid'));
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
$result=$object->update($object->id, $user);
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
if ($action == 'setstcomm')
{
$object = new Client($db);
$result=$object->fetch(GETPOST('stcommsocid'));
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
$result=$object->update($object->id, $user);
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
$action='';
}
$action='';
}
}
if ($search_status=='') $search_status=1; // always display active thirdparty first
@ -906,30 +906,30 @@ print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['s.name_alias']['checked'])) print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"],"s.name_alias","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder);
if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['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['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'],$_SERVER["PHP_SELF"],"s.phone","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'],$_SERVER["PHP_SELF"],"s.url","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer
if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['s.name_alias']['checked'])) print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"],"s.name_alias","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder);
if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['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['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'],$_SERVER["PHP_SELF"],"s.phone","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'],$_SERVER["PHP_SELF"],"s.url","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer
if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -945,12 +945,12 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
}
}
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";

View File

@ -284,7 +284,7 @@ if ($search_montant_vat != '') $sql.= natural_search("sp.tva", $search_montant_v
if ($search_montant_ttc != '') $sql.= natural_search("sp.total", $search_montant_ttc, 1);
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
if ($socid) $sql.= ' AND s.rowid = '.$socid;
if ($search_status >= 0 && $search_status != '') $sql.= ' AND sp.fk_statut IN ('.$search_status.')';
if ($search_status >= 0 && $search_status != '') $sql.= ' AND sp.fk_statut IN ('.$db->escape($search_status).')';
if ($month > 0)
{
if ($year > 0 && empty($day))