Merge pull request #17929 from Dolibarr/scrutinizer-patch-2
Scrutinizer Auto-Fixes
This commit is contained in:
commit
1a44d81c96
@ -297,11 +297,11 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " AND fk_doc = ".((int) $this->fk_doc);
|
||||
if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) {
|
||||
// DO NOT USE THIS IN PRODUCTION. This will generate a lot of trouble into reports and will corrupt database (by generating duplicate entries.
|
||||
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines
|
||||
$sql .= " AND fk_docdet = ".$this->fk_docdet; // This field can be 0 if record is for several lines
|
||||
}
|
||||
$sql .= " AND numero_compte = '".$this->db->escape($this->numero_compte)."'";
|
||||
$sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'";
|
||||
$sql .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
|
||||
$sql .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -318,7 +318,7 @@ class BookKeeping extends CommonObject
|
||||
$sqlnum .= " AND fk_docdet = ".((int) $this->fk_docdet);
|
||||
}
|
||||
$sqlnum .= " AND doc_ref = '".$this->db->escape($this->doc_ref)."'"; // ref of source object
|
||||
$sqlnum .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
|
||||
$sqlnum .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
|
||||
|
||||
dol_syslog(get_class($this).":: create sqlnum=".$sqlnum, LOG_DEBUG);
|
||||
$resqlnum = $this->db->query($sqlnum);
|
||||
@ -331,7 +331,7 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->piece_num)) {
|
||||
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
||||
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features
|
||||
$sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features
|
||||
|
||||
$resqlnum = $this->db->query($sqlnum);
|
||||
if ($resqlnum) {
|
||||
@ -1067,7 +1067,7 @@ class BookKeeping extends CommonObject
|
||||
$line->label_operation = $obj->label_operation;
|
||||
$line->debit = $obj->debit;
|
||||
$line->credit = $obj->credit;
|
||||
$line->montant = $obj->amount; // deprecated
|
||||
$line->montant = $obj->amount; // deprecated
|
||||
$line->amount = $obj->amount;
|
||||
$line->sens = $obj->sens;
|
||||
$line->lettering_code = $obj->lettering_code;
|
||||
|
||||
@ -126,7 +126,7 @@ $sql .= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id =
|
||||
$sql .= " AND f.module_source = '".$db->escape($posmodule)."'";
|
||||
$sql .= " AND f.pos_source = '".$db->escape($terminalid)."'";
|
||||
$sql .= " AND f.paye = 1";
|
||||
$sql .= " AND p.entity = ".$conf->entity; // Never share entities for features related to accountancy
|
||||
$sql .= " AND p.entity = ".$conf->entity; // Never share entities for features related to accountancy
|
||||
/*if ($key == 'cash') $sql.=" AND cp.code = 'LIQ'";
|
||||
elseif ($key == 'cheque') $sql.=" AND cp.code = 'CHQ'";
|
||||
elseif ($key == 'card') $sql.=" AND cp.code = 'CB'";
|
||||
@ -222,7 +222,7 @@ if ($resql) {
|
||||
$invoicetmp->fetch($objp->facid);
|
||||
|
||||
if (empty($cacheinvoiceid[$objp->facid])) {
|
||||
$cacheinvoiceid[$objp->facid] = $objp->facid; // First time this invoice is found into list of invoice x payments
|
||||
$cacheinvoiceid[$objp->facid] = $objp->facid; // First time this invoice is found into list of invoice x payments
|
||||
foreach ($invoicetmp->lines as $line) {
|
||||
$totalqty += $line->qty;
|
||||
$totalvat += $line->total_tva;
|
||||
@ -348,21 +348,21 @@ if ($resql) {
|
||||
print '<div style="text-align: right">';
|
||||
print '<h2>';
|
||||
|
||||
print $langs->trans("Cash").' '.($transactionspertype['CASH']?'('.$transactionspertype['CASH'].')':'').': <span class="amount">'.price($cash).'</span>';
|
||||
print $langs->trans("Cash").' '.($transactionspertype['CASH'] ? '('.$transactionspertype['CASH'].')' : '').': <span class="amount">'.price($cash).'</span>';
|
||||
if ($object->status == $object::STATUS_VALIDATED && $cash != $object->cash) {
|
||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->cash).'</span>';
|
||||
}
|
||||
print "<br>";
|
||||
|
||||
//print '<br>';
|
||||
print $langs->trans("PaymentTypeCHQ").' '.($transactionspertype['CHQ']?'('.$transactionspertype['CHQ'].')':'').': <span class="amount">'.price($cheque).'</span>';
|
||||
print $langs->trans("PaymentTypeCHQ").' '.($transactionspertype['CHQ'] ? '('.$transactionspertype['CHQ'].')' : '').': <span class="amount">'.price($cheque).'</span>';
|
||||
if ($object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) {
|
||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->cheque).'</span>';
|
||||
}
|
||||
print "<br>";
|
||||
|
||||
//print '<br>';
|
||||
print $langs->trans("PaymentTypeCB").' '.($transactionspertype['CB']?'('.$transactionspertype['CB'].')':'').': <span class="amount">'.price($bank).'</span>';
|
||||
print $langs->trans("PaymentTypeCB").' '.($transactionspertype['CB'] ? '('.$transactionspertype['CB'].')' : '').': <span class="amount">'.price($bank).'</span>';
|
||||
if ($object->status == $object::STATUS_VALIDATED && $bank != $object->card) {
|
||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->card).'</span>';
|
||||
}
|
||||
@ -370,7 +370,7 @@ if ($resql) {
|
||||
|
||||
// print '<br>';
|
||||
if ($other) {
|
||||
print ''.$langs->trans("Other").' '.($transactionspertype['OTHER']?'('.$transactionspertype['OTHER'].')':'').': <span class="amount">'.price($other)."</span>";
|
||||
print ''.$langs->trans("Other").' '.($transactionspertype['OTHER'] ? '('.$transactionspertype['OTHER'].')' : '').': <span class="amount">'.price($other)."</span>";
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
@ -522,7 +522,7 @@ class Facture extends CommonInvoice
|
||||
$this->fk_project = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_project;
|
||||
$this->note_public = GETPOST('note_public', 'none') ? GETPOST('note_public', 'restricthtml') : $_facrec->note_public;
|
||||
$this->note_private = GETPOST('note_private', 'none') ? GETPOST('note_private', 'restricthtml') : $_facrec->note_private;
|
||||
$this->model_pdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->model_pdf;
|
||||
$this->model_pdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->model_pdf;
|
||||
$this->cond_reglement_id = GETPOST('cond_reglement_id', 'int') > 0 ? ((int) GETPOST('cond_reglement_id', 'int')) : $_facrec->cond_reglement_id;
|
||||
$this->mode_reglement_id = GETPOST('mode_reglement_id', 'int') > 0 ? ((int) GETPOST('mode_reglement_id', 'int')) : $_facrec->mode_reglement_id;
|
||||
$this->fk_account = GETPOST('fk_account') > 0 ? ((int) GETPOST('fk_account')) : $_facrec->fk_account;
|
||||
@ -1180,8 +1180,8 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Clear fields
|
||||
$object->date = (empty($this->date) ? dol_now() : $this->date);
|
||||
$object->user_author = $user->id; // deprecated
|
||||
$object->user_valid = null; // deprecated
|
||||
$object->user_author = $user->id; // deprecated
|
||||
$object->user_valid = null; // deprecated
|
||||
$object->fk_user_author = $user->id;
|
||||
$object->fk_user_valid = null;
|
||||
$object->fk_facture_source = 0;
|
||||
@ -1227,7 +1227,7 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
$object->lines[$i]->ref_ext = ''; // Do not clone ref_ext
|
||||
$object->lines[$i]->ref_ext = ''; // Do not clone ref_ext
|
||||
}
|
||||
|
||||
// Create clone
|
||||
@ -1672,9 +1672,9 @@ class Facture extends CommonInvoice
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->user_author = $obj->fk_user_author; // deprecated
|
||||
$this->user_valid = $obj->fk_user_valid; // deprecated
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->user_author = $obj->fk_user_author; // deprecated
|
||||
$this->user_valid = $obj->fk_user_valid; // deprecated
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->fk_user_valid = $obj->fk_user_valid;
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
$this->modelpdf = $obj->model_pdf; // deprecated
|
||||
@ -3430,7 +3430,7 @@ class Facture extends CommonInvoice
|
||||
$qty = price2num($qty);
|
||||
$pu = price2num($pu);
|
||||
$pu_ht_devise = price2num($pu_ht_devise);
|
||||
$pa_ht = price2num($pa_ht);
|
||||
$pa_ht = price2num($pa_ht);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
}
|
||||
@ -4158,7 +4158,7 @@ class Facture extends CommonInvoice
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE)) {
|
||||
// Keep invoices that are not situation invoices or that are the last in serie if it is a situation invoice
|
||||
$sql .= " AND (f.type <> ".self::TYPE_SITUATION." OR f.rowid IN ";
|
||||
$sql .= '(SELECT MAX(fs.rowid)'; // This select returns several ID becasue of the group by later
|
||||
$sql .= '(SELECT MAX(fs.rowid)'; // This select returns several ID becasue of the group by later
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as fs";
|
||||
$sql .= " WHERE fs.entity IN (".getEntity('invoice').")";
|
||||
$sql .= " AND fs.type = ".self::TYPE_SITUATION;
|
||||
@ -4166,7 +4166,7 @@ class Facture extends CommonInvoice
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND fs.fk_soc = ".((int) $socid);
|
||||
}
|
||||
$sql .= " GROUP BY fs.situation_cycle_ref)"; // For each situation_cycle_ref, we take the higher rowid
|
||||
$sql .= " GROUP BY fs.situation_cycle_ref)"; // For each situation_cycle_ref, we take the higher rowid
|
||||
$sql .= ")";
|
||||
} else {
|
||||
$sql .= " AND f.type <> ".self::TYPE_SITUATION; // Keep invoices that are not situation invoices
|
||||
@ -5594,7 +5594,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$sql .= ", total_localtax2=".price2num($this->total_localtax2);
|
||||
}
|
||||
$sql .= ", fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null");
|
||||
$sql .= ", buy_price_ht=".(($this->pa_ht || $this->pa_ht === 0 || $this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option)
|
||||
$sql .= ", buy_price_ht=".(($this->pa_ht || $this->pa_ht === 0 || $this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option)
|
||||
$sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null");
|
||||
if (!empty($this->rang)) {
|
||||
$sql .= ", rang=".((int) $this->rang);
|
||||
|
||||
@ -225,7 +225,7 @@ if (empty($reshook)) {
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1 && $object->no_email==-1 && !empty($object->email)) {
|
||||
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1 && $object->no_email == -1 && !empty($object->email)) {
|
||||
$error++;
|
||||
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
|
||||
$action = 'create';
|
||||
@ -256,7 +256,7 @@ if (empty($reshook)) {
|
||||
if (empty($error)) {
|
||||
// Categories association
|
||||
$contcats = GETPOST('contcats', 'array');
|
||||
if (count($contcats)>0) {
|
||||
if (count($contcats) > 0) {
|
||||
$result = $object->setCategories($contcats);
|
||||
if ($result <= 0) {
|
||||
$error++;
|
||||
@ -268,8 +268,8 @@ if (empty($reshook)) {
|
||||
|
||||
if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email)) {
|
||||
// Add mass emailing flag into table mailing_unsubscribe
|
||||
$result=$object->setNoEmail($object->no_email);
|
||||
if ($result<0) {
|
||||
$result = $object->setNoEmail($object->no_email);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$errors = array_merge($errors, ($object->error ? array($object->error) : $object->errors));
|
||||
$action = 'create';
|
||||
@ -297,7 +297,7 @@ if (empty($reshook)) {
|
||||
$object->old_lastname = (string) GETPOST("old_lastname", 'alpha');
|
||||
$object->old_firstname = (string) GETPOST("old_firstname", 'alpha');
|
||||
|
||||
$result = $object->delete(); // TODO Add $user as first param
|
||||
$result = $object->delete(); // TODO Add $user as first param
|
||||
if ($result > 0) {
|
||||
if ($backtopage) {
|
||||
header("Location: ".$backtopage);
|
||||
@ -317,7 +317,7 @@ if (empty($reshook)) {
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1 && GETPOST("no_email", "int")==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
|
||||
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
|
||||
$error++;
|
||||
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
|
||||
$action = 'edit';
|
||||
@ -417,7 +417,7 @@ if (empty($reshook)) {
|
||||
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
|
||||
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
|
||||
|
||||
$object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty
|
||||
$object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
@ -436,8 +436,8 @@ if (empty($reshook)) {
|
||||
// Update mass emailing flag into table mailing_unsubscribe
|
||||
if (GETPOSTISSET('no_email') && $object->email) {
|
||||
$no_email = GETPOST('no_email', 'int');
|
||||
$result=$object->setNoEmail($no_email);
|
||||
if ($result<0) {
|
||||
$result = $object->setNoEmail($no_email);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
@ -779,7 +779,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Unsubscribe
|
||||
if (!empty($conf->mailing->enabled)) {
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1) {
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">'."\n";
|
||||
print '$(document).ready(function () {
|
||||
$("#email").keyup(function() {
|
||||
@ -793,14 +793,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</script>'."\n";
|
||||
}
|
||||
if (!GETPOSTISSET("no_email") && !empty($object->email)) {
|
||||
$result=$object->getNoEmail();
|
||||
if ($result<0) {
|
||||
$result = $object->getNoEmail();
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
print '<tr>';
|
||||
print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
|
||||
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1)).'</td>';
|
||||
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1)).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -1078,8 +1078,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</script>'."\n";
|
||||
}
|
||||
if (!GETPOSTISSET("no_email") && !empty($object->email)) {
|
||||
$result=$object->getNoEmail();
|
||||
if ($result<0) {
|
||||
$result = $object->getNoEmail();
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
@ -1313,8 +1313,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Unsubscribe opt-out
|
||||
if (!empty($conf->mailing->enabled)) {
|
||||
$result=$object->getNoEmail();
|
||||
if ($result<0) {
|
||||
$result = $object->getNoEmail();
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("No_Email").'</td><td>'.yn($object->no_email).'</td></tr>';
|
||||
|
||||
@ -89,7 +89,7 @@ class box_graph_new_vs_close_ticket extends ModeleBoxes
|
||||
$data = array();
|
||||
$totalnb = 0;
|
||||
$sql = "SELECT COUNT(t.datec) as nb";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
|
||||
$sql .= " WHERE CAST(t.datec AS DATE) = CURRENT_DATE";
|
||||
$sql .= " AND t.fk_statut <> 8";
|
||||
$sql .= " GROUP BY CAST(t.datec AS DATE)";
|
||||
@ -107,7 +107,7 @@ class box_graph_new_vs_close_ticket extends ModeleBoxes
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$sql = "SELECT COUNT(t.date_close) as nb";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
|
||||
$sql .= " WHERE CAST(t.date_close AS DATE) = CURRENT_DATE";
|
||||
$sql .= " AND t.fk_statut = 8";
|
||||
$sql .= " GROUP BY CAST(t.date_close AS DATE)";
|
||||
@ -148,7 +148,7 @@ class box_graph_new_vs_close_ticket extends ModeleBoxes
|
||||
$stringtoprint .= $px1->show($totalnb ? 0 : 1);
|
||||
}
|
||||
$stringtoprint .= '</div>';
|
||||
$this->info_box_contents[][]=array(
|
||||
$this->info_box_contents[][] = array(
|
||||
'td' => 'class="center"',
|
||||
'text' => $stringtoprint
|
||||
);
|
||||
|
||||
@ -508,16 +508,16 @@ function getNumberInvoicesPieChart($mode)
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$dataseries = array(array($langs->trans('InvoiceLate30Days'),$obj->nblate30)
|
||||
,array($langs->trans('InvoiceLate15Days'),$obj->nblate15-$obj->nblate30)
|
||||
,array($langs->trans('InvoiceLateMinus15Days'),$obj->nblatenow-$obj->nblate15)
|
||||
,array($langs->trans('InvoiceNotLate'),$obj->nbnotlatenow-$obj->nbnotlate15)
|
||||
,array($langs->trans('InvoiceNotLate15Days'),$obj->nbnotlate15-$obj->nbnotlate30)
|
||||
,array($langs->trans('InvoiceNotLate30Days'),$obj->nbnotlate30));
|
||||
$dataseries = array(array($langs->trans('InvoiceLate30Days'), $obj->nblate30)
|
||||
,array($langs->trans('InvoiceLate15Days'), $obj->nblate15 - $obj->nblate30)
|
||||
,array($langs->trans('InvoiceLateMinus15Days'), $obj->nblatenow - $obj->nblate15)
|
||||
,array($langs->trans('InvoiceNotLate'), $obj->nbnotlatenow - $obj->nbnotlate15)
|
||||
,array($langs->trans('InvoiceNotLate15Days'), $obj->nbnotlate15 - $obj->nbnotlate30)
|
||||
,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30));
|
||||
$i++;
|
||||
}
|
||||
foreach ($dataseries as $key=>$value) {
|
||||
$total+=$value[1];
|
||||
$total += $value[1];
|
||||
}
|
||||
|
||||
$colorseries = array($badgeStatus8, $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus11, '-'.$badgeStatus11);
|
||||
@ -615,7 +615,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0)
|
||||
$sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
|
||||
$sql .= " cc.rowid, cc.code";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql.= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= ", sc.fk_soc, sc.fk_user";
|
||||
}
|
||||
|
||||
// Add Group from hooks
|
||||
|
||||
@ -714,7 +714,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$this->remise = $obj->remise;
|
||||
$this->close_code = $obj->close_code;
|
||||
$this->close_note = $obj->close_note;
|
||||
$this->tva = $obj->tva;
|
||||
$this->tva = $obj->tva;
|
||||
$this->total_localtax1 = $obj->localtax1;
|
||||
$this->total_localtax2 = $obj->localtax2;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
@ -729,7 +729,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$this->fk_project = $obj->fk_project;
|
||||
$this->cond_reglement_id = $obj->fk_cond_reglement;
|
||||
$this->cond_reglement_code = $obj->cond_reglement_code;
|
||||
$this->cond_reglement = $obj->cond_reglement_label; // deprecated
|
||||
$this->cond_reglement = $obj->cond_reglement_label; // deprecated
|
||||
$this->cond_reglement_label = $obj->cond_reglement_label;
|
||||
$this->cond_reglement_doc = $obj->cond_reglement_doc;
|
||||
$this->fk_account = $obj->fk_account;
|
||||
@ -3234,8 +3234,8 @@ class SupplierInvoiceLine extends CommonObjectLine
|
||||
$this->ref_supplier = $obj->ref_supplier;
|
||||
$this->product_desc = $obj->product_desc;
|
||||
|
||||
$this->subprice = $obj->pu_ht;
|
||||
$this->pu_ht = $obj->pu_ht;
|
||||
$this->subprice = $obj->pu_ht;
|
||||
$this->pu_ht = $obj->pu_ht;
|
||||
$this->pu_ttc = $obj->pu_ttc;
|
||||
$this->tva_tx = $obj->tva_tx;
|
||||
$this->localtax1_tx = $obj->localtax1_tx;
|
||||
@ -3245,7 +3245,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
||||
|
||||
$this->qty = $obj->qty;
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
$this->fk_remise_except = $obj->fk_remise_except;
|
||||
$this->fk_remise_except = $obj->fk_remise_except;
|
||||
$this->tva = $obj->total_tva; // deprecated
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
@ -3401,8 +3401,8 @@ class SupplierInvoiceLine extends CommonObjectLine
|
||||
$sql .= ", pu_ttc = ".price2num($this->pu_ttc);
|
||||
$sql .= ", qty = ".price2num($this->qty);
|
||||
$sql .= ", remise_percent = ".price2num($this->remise_percent);
|
||||
if ($this->fk_remise_except) $sql.= ", fk_remise_except=".((int) $this->fk_remise_except);
|
||||
else $sql.= ", fk_remise_except=null";
|
||||
if ($this->fk_remise_except) $sql .= ", fk_remise_except=".((int) $this->fk_remise_except);
|
||||
else $sql .= ", fk_remise_except=null";
|
||||
$sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'";
|
||||
$sql .= ", tva_tx = ".price2num($this->tva_tx);
|
||||
$sql .= ", localtax1_tx = ".price2num($this->localtax1_tx);
|
||||
@ -3633,7 +3633,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
||||
if ($discount->fk_facture_line > 0) {
|
||||
if (empty($noerrorifdiscountalreadylinked)) {
|
||||
$this->error = $langs->trans("ErrorDiscountAlreadyUsed", $discount->id);
|
||||
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
@ -3641,20 +3641,20 @@ class SupplierInvoiceLine extends CommonObjectLine
|
||||
$result = $discount->link_to_invoice($this->rowid, 0);
|
||||
if ($result < 0) {
|
||||
$this->error = $discount->error;
|
||||
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded");
|
||||
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
} else {
|
||||
$this->error = $discount->error;
|
||||
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
|
||||
@ -134,8 +134,8 @@ print '</tr>';
|
||||
if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").'</td>';
|
||||
print '<td>';
|
||||
$dnbdays = '15';
|
||||
$backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays;
|
||||
$dnbdays = '15';
|
||||
$backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays;
|
||||
print '<input class="maxwidth50" type="text" name="PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL" value="'.$backlinks.'">';
|
||||
print '</td>';
|
||||
print '<td><span class="opacitymedium">'.$dnbdays.'</span></td>';
|
||||
@ -164,7 +164,7 @@ print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PARTNERSHIP_BACKLINKS_TO_CHECK").'</td>';
|
||||
print '<td>';
|
||||
$backlinks = (empty($conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK) ? '' : $conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK);
|
||||
$backlinks = (empty($conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK) ? '' : $conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK);
|
||||
print '<input class="minwidth400" type="text" name="PARTNERSHIP_BACKLINKS_TO_CHECK" value="'.$backlinks.'">';
|
||||
print '</td>';
|
||||
print '<td><span class="opacitymedium">dolibarr.org|dolibarr.fr|dolibarr.es</span></td>';
|
||||
|
||||
@ -37,9 +37,9 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
*/
|
||||
class PartnershipUtils
|
||||
{
|
||||
public $db; //!< To store db handler
|
||||
public $error; //!< To return error code (or message)
|
||||
public $errors=array(); //!< To return several error codes (or messages)
|
||||
public $db; //!< To store db handler
|
||||
public $error; //!< To return error code (or message)
|
||||
public $errors = array(); //!< To return several error codes (or messages)
|
||||
|
||||
|
||||
/**
|
||||
@ -71,19 +71,19 @@ class PartnershipUtils
|
||||
}
|
||||
|
||||
$partnership = new Partnership($this->db);
|
||||
$MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL) ? 25 : $conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL); // Limit to 25 per call
|
||||
$MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL) ? 25 : $conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL); // Limit to 25 per call
|
||||
|
||||
$langs->loadLangs(array("partnership", "member"));
|
||||
|
||||
$error = 0;
|
||||
$erroremail = '';
|
||||
$this->output = '';
|
||||
$this->error = '';
|
||||
$error = 0;
|
||||
$erroremail = '';
|
||||
$this->output = '';
|
||||
$this->error = '';
|
||||
$partnershipsprocessed = array();
|
||||
|
||||
$gracedelay=$conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL;
|
||||
$gracedelay = $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL;
|
||||
if ($gracedelay < 1) {
|
||||
$this->error='BadValueForDelayBeforeCancelCheckSetup';
|
||||
$this->error = 'BadValueForDelayBeforeCancelCheckSetup';
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ class PartnershipUtils
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
if (! empty($partnershipsprocessed[$obj->rowid])) continue;
|
||||
if (!empty($partnershipsprocessed[$obj->rowid])) continue;
|
||||
|
||||
if ($somethingdoneonpartnership >= $MAXPERCALL) {
|
||||
dol_syslog("We reach the limit of ".$MAXPERCALL." partnership processed, so we quit loop for this batch doCancelStatusOfMemberPartnership to avoid to reach email quota.", LOG_WARNING);
|
||||
@ -142,7 +142,7 @@ class PartnershipUtils
|
||||
else $this->errors = $object->errors;
|
||||
}
|
||||
} else {
|
||||
$partnershipsprocessed[$object->id]=$object->ref;
|
||||
$partnershipsprocessed[$object->id] = $object->ref;
|
||||
|
||||
// Send an email to inform member
|
||||
$labeltemplate = '(SendingEmailOnPartnershipCanceled)';
|
||||
@ -152,21 +152,21 @@ class PartnershipUtils
|
||||
// Send deployment email
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$formmail=new FormMail($this->db);
|
||||
$formmail = new FormMail($this->db);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||
if (! empty($newlang)) {
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->loadLangs(array('main','member','partnership'));
|
||||
$outputlangs->loadLangs(array('main', 'member', 'partnership'));
|
||||
}
|
||||
|
||||
$arraydefaultmessage=$formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate);
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate);
|
||||
|
||||
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
|
||||
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
|
||||
@ -179,7 +179,7 @@ class PartnershipUtils
|
||||
|
||||
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1);
|
||||
$result = $cmail->sendfile();
|
||||
if (! $result || $cmail->error) {
|
||||
if (!$result || $cmail->error) {
|
||||
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
|
||||
$this->errors[] = $cmail->error;
|
||||
if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
|
||||
@ -193,18 +193,18 @@ class PartnershipUtils
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
$this->output = $numofexpiredmembers.' expired partnership members found'."\n";
|
||||
if ($erroremail) $this->output.='. Got errors when sending some email : '.$erroremail;
|
||||
if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
$this->output = "Rollback after error\n";
|
||||
$this->output.= $numofexpiredmembers.' expired partnership members found'."\n";
|
||||
if ($erroremail) $this->output.='. Got errors when sending some email : '.$erroremail;
|
||||
$this->output .= $numofexpiredmembers.' expired partnership members found'."\n";
|
||||
if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail;
|
||||
}
|
||||
|
||||
return ($error ? 1: 0);
|
||||
return ($error ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
@ -222,19 +222,19 @@ class PartnershipUtils
|
||||
$managedfor = $conf->global->PARTNERSHIP_IS_MANAGED_FOR;
|
||||
|
||||
$partnership = new Partnership($this->db);
|
||||
$MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL) ? 10 : $conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL); // Limit to 10 per call
|
||||
$MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL) ? 10 : $conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL); // Limit to 10 per call
|
||||
|
||||
$langs->loadLangs(array("partnership", "member"));
|
||||
|
||||
$error = 0;
|
||||
$erroremail = '';
|
||||
$this->output = '';
|
||||
$this->error = '';
|
||||
$error = 0;
|
||||
$erroremail = '';
|
||||
$this->output = '';
|
||||
$this->error = '';
|
||||
$partnershipsprocessed = array();
|
||||
|
||||
$gracedelay=$conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL;
|
||||
$gracedelay = $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL;
|
||||
if ($gracedelay < 1) {
|
||||
$this->error='BadValueForDelayBeforeCancelCheckSetup';
|
||||
$this->error = 'BadValueForDelayBeforeCancelCheckSetup';
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -269,16 +269,16 @@ class PartnershipUtils
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$numofexpiredmembers = $this->db->num_rows($resql);
|
||||
$numofexpiredmembers = $this->db->num_rows($resql);
|
||||
$somethingdoneonpartnership = 0;
|
||||
$ifetchpartner = 0;
|
||||
$ifetchpartner = 0;
|
||||
$websitenotfound = '';
|
||||
while ($ifetchpartner < $numofexpiredmembers) {
|
||||
$ifetchpartner++;
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
if (! empty($partnershipsprocessed[$obj->rowid])) continue;
|
||||
if (!empty($partnershipsprocessed[$obj->rowid])) continue;
|
||||
|
||||
if ($somethingdoneonpartnership >= $MAXPERCALL) {
|
||||
dol_syslog("We reach the limit of ".$MAXPERCALL." partnership processed, so we quit loop for this batch doWarningOfPartnershipIfDolibarrBacklinkNotfound to avoid to reach email quota.", LOG_WARNING);
|
||||
@ -318,21 +318,21 @@ class PartnershipUtils
|
||||
// Send deployment email
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$formmail=new FormMail($this->db);
|
||||
$formmail = new FormMail($this->db);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||
if (! empty($newlang)) {
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->loadLangs(array('main','member','partnership'));
|
||||
$outputlangs->loadLangs(array('main', 'member', 'partnership'));
|
||||
}
|
||||
|
||||
$arraydefaultmessage=$formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate);
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate);
|
||||
|
||||
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
|
||||
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
|
||||
@ -343,7 +343,7 @@ class PartnershipUtils
|
||||
|
||||
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1);
|
||||
$result = $cmail->sendfile();
|
||||
if (! $result || $cmail->error) {
|
||||
if (!$result || $cmail->error) {
|
||||
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
|
||||
$this->errors[] = $cmail->error;
|
||||
if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
|
||||
@ -360,7 +360,7 @@ class PartnershipUtils
|
||||
$object->reason_decline_or_cancel = '';
|
||||
}
|
||||
|
||||
$partnershipsprocessed[$object->id]=$object->ref;
|
||||
$partnershipsprocessed[$object->id] = $object->ref;
|
||||
|
||||
$object->last_check_backlink = $this->db->idate($now);
|
||||
|
||||
@ -372,22 +372,22 @@ class PartnershipUtils
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
$this->output = $numofexpiredmembers.' partnership checked'."\n";
|
||||
if ($erroremail) $this->output.='. Got errors when sending some email : '.$erroremail."\n";
|
||||
if ($emailnotfound) $this->output.='. Email not found for some partner : '.$emailnotfound."\n";
|
||||
if ($websitenotfound) $this->output.='. Website not found for some partner : '.$websitenotfound."\n";
|
||||
if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail."\n";
|
||||
if ($emailnotfound) $this->output .= '. Email not found for some partner : '.$emailnotfound."\n";
|
||||
if ($websitenotfound) $this->output .= '. Website not found for some partner : '.$websitenotfound."\n";
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
$this->output = "Rollback after error\n";
|
||||
$this->output.= $numofexpiredmembers.' partnership checked'."\n";
|
||||
if ($erroremail) $this->output.='. Got errors when sending some email : '.$erroremail."\n";
|
||||
if ($emailnotfound) $this->output.='. Email not found for some partner : '.$emailnotfound."\n";
|
||||
if ($websitenotfound) $this->output.='. Website not found for some partner : '.$websitenotfound."\n";
|
||||
$this->output .= $numofexpiredmembers.' partnership checked'."\n";
|
||||
if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail."\n";
|
||||
if ($emailnotfound) $this->output .= '. Email not found for some partner : '.$emailnotfound."\n";
|
||||
if ($websitenotfound) $this->output .= '. Website not found for some partner : '.$websitenotfound."\n";
|
||||
}
|
||||
|
||||
return ($error ? 1: 0);
|
||||
return ($error ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -82,7 +82,7 @@ if ($managedfor != 'member' && $sortfield == 'd.datefin') $sortfield = '';
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (!$sortfield) {
|
||||
reset($object->fields); // Reset is required to avoid key() to return null.
|
||||
reset($object->fields); // Reset is required to avoid key() to return null.
|
||||
$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
}
|
||||
if (!$sortorder) {
|
||||
@ -136,8 +136,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = $user->rights->partnership->read;
|
||||
$permissiontoadd = $user->rights->partnership->write;
|
||||
$permissiontoread = $user->rights->partnership->read;
|
||||
$permissiontoadd = $user->rights->partnership->write;
|
||||
$permissiontodelete = $user->rights->partnership->delete;
|
||||
|
||||
// Security check
|
||||
@ -305,13 +305,13 @@ foreach ($search as $key => $val) {
|
||||
}
|
||||
} else {
|
||||
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
|
||||
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
|
||||
$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
|
||||
if (preg_match('/_dtstart$/', $key)) {
|
||||
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
|
||||
$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
|
||||
}
|
||||
if (preg_match('/_dtend$/', $key)) {
|
||||
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
|
||||
$sql .= " AND t.".$columnName." <= '".$db->idate($search[$key])."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -538,7 +538,7 @@ foreach ($object->fields as $key => $val) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
|
||||
@ -315,11 +315,11 @@ if (empty($reshook)) {
|
||||
|
||||
$object->type = $type;
|
||||
$object->status = GETPOST('statut');
|
||||
$object->status_buy = GETPOST('statut_buy');
|
||||
$object->status_buy = GETPOST('statut_buy');
|
||||
$object->status_batch = GETPOST('status_batch');
|
||||
$object->batch_mask = GETPOST('batch_mask');
|
||||
|
||||
$object->barcode_type = GETPOST('fk_barcode_type');
|
||||
$object->barcode_type = GETPOST('fk_barcode_type');
|
||||
$object->barcode = GETPOST('barcode');
|
||||
// Set barcode_type_xxx from barcode_type id
|
||||
$stdobject = new GenericObject($db);
|
||||
@ -1620,10 +1620,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$tooltip .= $langs->trans("GenericMaskCodes5");
|
||||
print '<tr><td id="mask_option">'.$langs->trans("ManageLotMask").'</td>';
|
||||
if ($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') {
|
||||
$mask = ! empty($object->batch_mask) ? $object->batch_mask : $conf->global->LOT_ADVANCED_MASK;
|
||||
$mask = !empty($object->batch_mask) ? $object->batch_mask : $conf->global->LOT_ADVANCED_MASK;
|
||||
}
|
||||
if ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced') {
|
||||
$mask = ! empty($object->batch_mask) ? $object->batch_mask : $conf->global->SN_ADVANCED_MASK;
|
||||
$mask = !empty($object->batch_mask) ? $object->batch_mask : $conf->global->SN_ADVANCED_MASK;
|
||||
}
|
||||
$inherited_mask_lot = $conf->global->LOT_ADVANCED_MASK;
|
||||
$inherited_mask_sn = $conf->global->SN_ADVANCED_MASK;
|
||||
@ -2011,7 +2011,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$formbarcode = new FormBarCode($db);
|
||||
}
|
||||
|
||||
$fk_barcode_type='';
|
||||
$fk_barcode_type = '';
|
||||
if ($action == 'editbarcodetype') {
|
||||
print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type');
|
||||
$fk_barcode_type = $object->barcode_type;
|
||||
@ -2057,7 +2057,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
|
||||
print $object->getLibStatut(0, 2);
|
||||
print '</td></tr>';
|
||||
if ((($object->status_batch == '1' &&$conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced')
|
||||
if ((($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced')
|
||||
|| ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS))) {
|
||||
print '<tr><td>'.$langs->trans("ManageLotMask").'</td><td>';
|
||||
print $object->batch_mask;
|
||||
|
||||
@ -169,7 +169,7 @@ if (empty($reshook)) {
|
||||
// Modification entrepot
|
||||
if ($action == 'update' && !$cancel) {
|
||||
if ($object->fetch($id)) {
|
||||
$object->label = GETPOST("libelle");
|
||||
$object->label = GETPOST("libelle");
|
||||
$object->fk_parent = GETPOST("fk_parent");
|
||||
$object->fk_project = GETPOST('projectid');
|
||||
$object->description = GETPOST("desc");
|
||||
@ -179,8 +179,8 @@ if (empty($reshook)) {
|
||||
$object->zip = GETPOST("zipcode");
|
||||
$object->town = GETPOST("town");
|
||||
$object->country_id = GETPOST("country_id");
|
||||
$object->phone = GETPOST("phone");
|
||||
$object->fax = GETPOST("fax");
|
||||
$object->phone = GETPOST("phone");
|
||||
$object->fax = GETPOST("fax");
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
@ -648,7 +648,7 @@ if ($action == 'create') {
|
||||
$sql .= " AND ps.fk_entrepot = ".((int) $object->id);
|
||||
|
||||
if ($separatedPMP) {
|
||||
$sql .= " AND pa.fk_product = p.rowid AND pa.entity = ". (int) $conf->entity;
|
||||
$sql .= " AND pa.fk_product = p.rowid AND pa.entity = ".(int) $conf->entity;
|
||||
}
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -28,7 +28,9 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.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/accountingjournal.class.php';
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "salaries", "bills", "hrm"));
|
||||
@ -52,8 +54,12 @@ if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST(
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) $sortfield = "s.datep,s.rowid";
|
||||
if (!$sortorder) $sortorder = "DESC,DESC";
|
||||
if (!$sortfield) {
|
||||
$sortfield = "s.datep,s.rowid";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "DESC,DESC";
|
||||
}
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new PaymentSalary($db);
|
||||
@ -66,8 +72,12 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
if (!$sortfield) $sortfield = "s.datep,s.rowid";
|
||||
if (!$sortorder) $sortorder = "DESC,DESC";
|
||||
if (!$sortfield) {
|
||||
$sortfield = "s.datep,s.rowid";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "DESC,DESC";
|
||||
}
|
||||
|
||||
$search_ref = GETPOST('search_ref', 'int');
|
||||
$search_ref_salary = GETPOST('search_ref_salary', 'int');
|
||||
@ -89,7 +99,9 @@ if (!GETPOST('search_type_id', 'int')) {
|
||||
$filterarray = explode('-', $newfiltre);
|
||||
foreach ($filterarray as $val) {
|
||||
$part = explode(':', $val);
|
||||
if ($part[0] == 's.fk_typepayment') $search_type_id = $part[1];
|
||||
if ($part[0] == 's.fk_typepayment') {
|
||||
$search_type_id = $part[1];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$search_type_id = GETPOST('search_type_id', 'int');
|
||||
@ -133,7 +145,9 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
@ -203,21 +217,47 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.ro
|
||||
$sql .= " ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.rowid = sal.fk_user";
|
||||
$sql .= " AND s.entity IN (".getEntity('payment_salaries').")";
|
||||
if (empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".$db->sanitize(join(',', $childids)).")";
|
||||
if (empty($user->rights->salaries->readall)) {
|
||||
$sql .= " AND s.fk_user IN (".$db->sanitize(join(',', $childids)).")";
|
||||
}
|
||||
|
||||
// Search criteria
|
||||
if ($search_ref) $sql .= " AND s.rowid=".((int) $search_ref);
|
||||
if ($search_ref_salary) $sql .= " AND sal.rowid=".((int) $search_ref_salary);
|
||||
if ($search_user) $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
|
||||
if ($search_label) $sql .= natural_search(array('sal.label'), $search_label);
|
||||
if ($search_date_start) $sql .= " AND s.datep >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND s.datep <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_dateep_start) $sql .= " AND sal.dateep >= '".$db->idate($search_dateep_start)."'";
|
||||
if ($search_dateep_end) $sql .= " AND sal.dateep <= '".$db->idate($search_dateep_end)."'";
|
||||
if ($search_amount) $sql .= natural_search("s.amount", $search_amount, 1);
|
||||
if ($search_account > 0) $sql .= " AND b.fk_account=".((int) $search_account);
|
||||
if ($search_fk_bank) $sql .= " AND s.fk_bank=".((int) $search_fk_bank);
|
||||
if ($search_chq_number) $sql .= natural_search(array('s.num_payment'), $search_chq_number);
|
||||
if ($search_ref) {
|
||||
$sql .= " AND s.rowid=".((int) $search_ref);
|
||||
}
|
||||
if ($search_ref_salary) {
|
||||
$sql .= " AND sal.rowid=".((int) $search_ref_salary);
|
||||
}
|
||||
if ($search_user) {
|
||||
$sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
|
||||
}
|
||||
if ($search_label) {
|
||||
$sql .= natural_search(array('sal.label'), $search_label);
|
||||
}
|
||||
if ($search_date_start) {
|
||||
$sql .= " AND s.datep >= '".$db->idate($search_date_start)."'";
|
||||
}
|
||||
if ($search_date_end) {
|
||||
$sql .= " AND s.datep <= '".$db->idate($search_date_end)."'";
|
||||
}
|
||||
if ($search_dateep_start) {
|
||||
$sql .= " AND sal.dateep >= '".$db->idate($search_dateep_start)."'";
|
||||
}
|
||||
if ($search_dateep_end) {
|
||||
$sql .= " AND sal.dateep <= '".$db->idate($search_dateep_end)."'";
|
||||
}
|
||||
if ($search_amount) {
|
||||
$sql .= natural_search("s.amount", $search_amount, 1);
|
||||
}
|
||||
if ($search_account > 0) {
|
||||
$sql .= " AND b.fk_account=".((int) $search_account);
|
||||
}
|
||||
if ($search_fk_bank) {
|
||||
$sql .= " AND s.fk_bank=".((int) $search_fk_bank);
|
||||
}
|
||||
if ($search_chq_number) {
|
||||
$sql .= natural_search(array('s.num_payment'), $search_chq_number);
|
||||
}
|
||||
|
||||
if ($search_type_id > 0) {
|
||||
$sql .= " AND s.fk_typepayment=".((int) $search_type_id);
|
||||
@ -238,7 +278,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
|
||||
$num = $nbtotalofrecords;
|
||||
} else {
|
||||
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
@ -257,21 +299,51 @@ llxHeader('', $title, $help_url);
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($search_type_id) $param .= '&search_type_id='.urlencode($search_type_id);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($search_ref_salary) $param .= '&search_ref_salary='.urlencode($search_ref_salary);
|
||||
if ($search_user) $param .= '&search_user='.urlencode($search_user);
|
||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||
if ($search_fk_bank) $param .= '&search_fk_bank='.urlencode($search_fk_bank);
|
||||
if ($search_chq_number) $param .= '&search_chq_number='.urlencode($search_chq_number);
|
||||
if ($search_account) $param .= '&search_account='.urlencode($search_account);
|
||||
if ($search_date_start) $param .= '&search_date_startday='.urlencode(GETPOST('search_date_startday', 'int')).'&search_date_startmonth='.urlencode(GETPOST('search_date_startmonth', 'int')).'&search_date_startyear='.urlencode(GETPOST('search_date_startyear', 'int'));
|
||||
if ($search_dateep_start) $param .= '&search_dateep_startday='.urlencode(GETPOST('search_dateep_startday', 'int')).'&search_dateep_startmonth='.urlencode(GETPOST('search_dateep_startmonth', 'int')).'&search_dateep_startyear='.urlencode(GETPOST('search_dateep_startyear', 'int'));
|
||||
if ($search_date_end) $param .= '&search_date_endday='.urlencode(GETPOST('search_date_endday', 'int')).'&search_date_endmonth='.urlencode(GETPOST('search_date_endmonth', 'int')).'&search_date_endyear='.urlencode(GETPOST('search_date_endyear', 'int'));
|
||||
if ($search_dateep_end) $param .= '&search_dateep_endday='.urlencode(GETPOST('search_dateep_endday', 'int')).'&search_dateep_endmonth='.urlencode(GETPOST('search_dateep_endmonth', 'int')).'&search_dateep_endyear='.urlencode(GETPOST('search_dateep_endyear', 'int'));
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
if ($search_type_id) {
|
||||
$param .= '&search_type_id='.urlencode($search_type_id);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
if ($search_ref) {
|
||||
$param .= '&search_ref='.urlencode($search_ref);
|
||||
}
|
||||
if ($search_ref_salary) {
|
||||
$param .= '&search_ref_salary='.urlencode($search_ref_salary);
|
||||
}
|
||||
if ($search_user) {
|
||||
$param .= '&search_user='.urlencode($search_user);
|
||||
}
|
||||
if ($search_label) {
|
||||
$param .= '&search_label='.urlencode($search_label);
|
||||
}
|
||||
if ($search_fk_bank) {
|
||||
$param .= '&search_fk_bank='.urlencode($search_fk_bank);
|
||||
}
|
||||
if ($search_chq_number) {
|
||||
$param .= '&search_chq_number='.urlencode($search_chq_number);
|
||||
}
|
||||
if ($search_account) {
|
||||
$param .= '&search_account='.urlencode($search_account);
|
||||
}
|
||||
if ($search_date_start) {
|
||||
$param .= '&search_date_startday='.urlencode(GETPOST('search_date_startday', 'int')).'&search_date_startmonth='.urlencode(GETPOST('search_date_startmonth', 'int')).'&search_date_startyear='.urlencode(GETPOST('search_date_startyear', 'int'));
|
||||
}
|
||||
if ($search_dateep_start) {
|
||||
$param .= '&search_dateep_startday='.urlencode(GETPOST('search_dateep_startday', 'int')).'&search_dateep_startmonth='.urlencode(GETPOST('search_dateep_startmonth', 'int')).'&search_dateep_startyear='.urlencode(GETPOST('search_dateep_startyear', 'int'));
|
||||
}
|
||||
if ($search_date_end) {
|
||||
$param .= '&search_date_endday='.urlencode(GETPOST('search_date_endday', 'int')).'&search_date_endmonth='.urlencode(GETPOST('search_date_endmonth', 'int')).'&search_date_endyear='.urlencode(GETPOST('search_date_endyear', 'int'));
|
||||
}
|
||||
if ($search_dateep_end) {
|
||||
$param .= '&search_dateep_endday='.urlencode(GETPOST('search_dateep_endday', 'int')).'&search_dateep_endmonth='.urlencode(GETPOST('search_dateep_endmonth', 'int')).'&search_dateep_endyear='.urlencode(GETPOST('search_dateep_endyear', 'int'));
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
@ -281,11 +353,15 @@ $arrayofmassactions = array(
|
||||
//'buildsepa'=>$langs->trans("BuildSepa"), // TODO
|
||||
);
|
||||
//if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
@ -294,7 +370,9 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$url = DOL_URL_ROOT.'/salaries/card.php?action=create';
|
||||
if (!empty($socid)) $url .= '&socid='.$socid;
|
||||
if (!empty($socid)) {
|
||||
$url .= '&socid='.$socid;
|
||||
}
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write);
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
@ -413,7 +491,10 @@ print '</tr>'."\n";
|
||||
$needToFetchEachLine = 0;
|
||||
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
|
||||
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
if (preg_match('/\$object/', $val)) {
|
||||
$needToFetchEachLine++;
|
||||
}
|
||||
// There is at least one compute field that use $object
|
||||
}
|
||||
}
|
||||
|
||||
@ -424,7 +505,10 @@ $total = 0;
|
||||
$totalarray = array();
|
||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
if (empty($obj)) {
|
||||
break;
|
||||
}
|
||||
// Should not happen
|
||||
|
||||
// Store properties in $object
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
@ -449,22 +533,32 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
|
||||
// Ref
|
||||
print "<td>".$paymentsalstatic->getNomUrl(1)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label payment
|
||||
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date end period
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->dateep), 'day')."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date payment
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date value
|
||||
/*print '<td class="center">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";
|
||||
@ -472,15 +566,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
|
||||
// Employee
|
||||
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Type
|
||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Chq number
|
||||
print '<td>'.$obj->num_payment.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
@ -489,7 +589,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$accountlinestatic->id = $obj->fk_bank;
|
||||
print $accountlinestatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
if ($obj->fk_bank > 0) {
|
||||
@ -514,15 +616,23 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
if ($accountstatic->id > 0) {
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
} else print ' ';
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Amount
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->amount).'</span></td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
|
||||
}
|
||||
$totalarray['val']['totalttcfield'] += $obj->amount;
|
||||
|
||||
// Extra fields
|
||||
@ -535,11 +645,15 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($object->id, $arrayofselected)) $selected = 1;
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
@ -553,7 +667,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
// If no record found
|
||||
if ($num == 0) {
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
|
||||
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies","partnership", "other"));
|
||||
$langs->loadLangs(array("companies", "partnership", "other"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
@ -82,19 +82,27 @@ foreach ($object->fields as $key => $val) {
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
|
||||
$permissiontoread = $user->rights->partnership->read;
|
||||
$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontoread = $user->rights->partnership->read;
|
||||
$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->partnership->write; // Used by the include of actions_dellink.inc.php
|
||||
$usercanclose = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
$usercanclose = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
||||
|
||||
if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'thirdparty') accessforbidden();
|
||||
if (empty($conf->partnership->enabled)) accessforbidden();
|
||||
if (empty($permissiontoread)) accessforbidden();
|
||||
if ($action == 'edit' && empty($permissiontoadd)) accessforbidden();
|
||||
if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'thirdparty') {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($conf->partnership->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($permissiontoread)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($action == 'edit' && empty($permissiontoadd)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT && !empty($user->socid)) {
|
||||
accessforbidden();
|
||||
@ -128,7 +136,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
$object->fields['fk_soc']['visible'] = 0;
|
||||
if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1;
|
||||
if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) {
|
||||
$object->fields['reason_decline_or_cancel']['visible'] = 1;
|
||||
}
|
||||
$object->fields['note_public']['visible'] = 1;
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user