Merge pull request #17929 from Dolibarr/scrutinizer-patch-2
Scrutinizer Auto-Fixes
This commit is contained in:
commit
1a44d81c96
@ -297,7 +297,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND fk_doc = ".((int) $this->fk_doc);
|
$sql .= " AND fk_doc = ".((int) $this->fk_doc);
|
||||||
if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) {
|
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.
|
// 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 numero_compte = '".$this->db->escape($this->numero_compte)."'";
|
||||||
$sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'";
|
$sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'";
|
||||||
|
|||||||
@ -348,21 +348,21 @@ if ($resql) {
|
|||||||
print '<div style="text-align: right">';
|
print '<div style="text-align: right">';
|
||||||
print '<h2>';
|
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) {
|
if ($object->status == $object::STATUS_VALIDATED && $cash != $object->cash) {
|
||||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->cash).'</span>';
|
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->cash).'</span>';
|
||||||
}
|
}
|
||||||
print "<br>";
|
print "<br>";
|
||||||
|
|
||||||
//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) {
|
if ($object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) {
|
||||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->cheque).'</span>';
|
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->cheque).'</span>';
|
||||||
}
|
}
|
||||||
print "<br>";
|
print "<br>";
|
||||||
|
|
||||||
//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) {
|
if ($object->status == $object::STATUS_VALIDATED && $bank != $object->card) {
|
||||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->card).'</span>';
|
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->card).'</span>';
|
||||||
}
|
}
|
||||||
@ -370,7 +370,7 @@ if ($resql) {
|
|||||||
|
|
||||||
// print '<br>';
|
// print '<br>';
|
||||||
if ($other) {
|
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>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -225,7 +225,7 @@ if (empty($reshook)) {
|
|||||||
$action = 'create';
|
$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++;
|
$error++;
|
||||||
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
|
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@ -256,7 +256,7 @@ if (empty($reshook)) {
|
|||||||
if (empty($error)) {
|
if (empty($error)) {
|
||||||
// Categories association
|
// Categories association
|
||||||
$contcats = GETPOST('contcats', 'array');
|
$contcats = GETPOST('contcats', 'array');
|
||||||
if (count($contcats)>0) {
|
if (count($contcats) > 0) {
|
||||||
$result = $object->setCategories($contcats);
|
$result = $object->setCategories($contcats);
|
||||||
if ($result <= 0) {
|
if ($result <= 0) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -268,8 +268,8 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email)) {
|
if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email)) {
|
||||||
// Add mass emailing flag into table mailing_unsubscribe
|
// Add mass emailing flag into table mailing_unsubscribe
|
||||||
$result=$object->setNoEmail($object->no_email);
|
$result = $object->setNoEmail($object->no_email);
|
||||||
if ($result<0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$errors = array_merge($errors, ($object->error ? array($object->error) : $object->errors));
|
$errors = array_merge($errors, ($object->error ? array($object->error) : $object->errors));
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@ -317,7 +317,7 @@ if (empty($reshook)) {
|
|||||||
$action = 'edit';
|
$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++;
|
$error++;
|
||||||
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
|
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
@ -436,8 +436,8 @@ if (empty($reshook)) {
|
|||||||
// Update mass emailing flag into table mailing_unsubscribe
|
// Update mass emailing flag into table mailing_unsubscribe
|
||||||
if (GETPOSTISSET('no_email') && $object->email) {
|
if (GETPOSTISSET('no_email') && $object->email) {
|
||||||
$no_email = GETPOST('no_email', 'int');
|
$no_email = GETPOST('no_email', 'int');
|
||||||
$result=$object->setNoEmail($no_email);
|
$result = $object->setNoEmail($no_email);
|
||||||
if ($result<0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
@ -779,7 +779,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
|
|
||||||
// Unsubscribe
|
// Unsubscribe
|
||||||
if (!empty($conf->mailing->enabled)) {
|
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 "\n".'<script type="text/javascript" language="javascript">'."\n";
|
||||||
print '$(document).ready(function () {
|
print '$(document).ready(function () {
|
||||||
$("#email").keyup(function() {
|
$("#email").keyup(function() {
|
||||||
@ -793,14 +793,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
if (!GETPOSTISSET("no_email") && !empty($object->email)) {
|
if (!GETPOSTISSET("no_email") && !empty($object->email)) {
|
||||||
$result=$object->getNoEmail();
|
$result = $object->getNoEmail();
|
||||||
if ($result<0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
|
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>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1078,8 +1078,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
if (!GETPOSTISSET("no_email") && !empty($object->email)) {
|
if (!GETPOSTISSET("no_email") && !empty($object->email)) {
|
||||||
$result=$object->getNoEmail();
|
$result = $object->getNoEmail();
|
||||||
if ($result<0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1313,8 +1313,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
|
|
||||||
// Unsubscribe opt-out
|
// Unsubscribe opt-out
|
||||||
if (!empty($conf->mailing->enabled)) {
|
if (!empty($conf->mailing->enabled)) {
|
||||||
$result=$object->getNoEmail();
|
$result = $object->getNoEmail();
|
||||||
if ($result<0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
print '<tr><td>'.$langs->trans("No_Email").'</td><td>'.yn($object->no_email).'</td></tr>';
|
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();
|
$data = array();
|
||||||
$totalnb = 0;
|
$totalnb = 0;
|
||||||
$sql = "SELECT COUNT(t.datec) as nb";
|
$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 .= " WHERE CAST(t.datec AS DATE) = CURRENT_DATE";
|
||||||
$sql .= " AND t.fk_statut <> 8";
|
$sql .= " AND t.fk_statut <> 8";
|
||||||
$sql .= " GROUP BY CAST(t.datec AS DATE)";
|
$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);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
$sql = "SELECT COUNT(t.date_close) as nb";
|
$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 .= " WHERE CAST(t.date_close AS DATE) = CURRENT_DATE";
|
||||||
$sql .= " AND t.fk_statut = 8";
|
$sql .= " AND t.fk_statut = 8";
|
||||||
$sql .= " GROUP BY CAST(t.date_close AS DATE)";
|
$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 .= $px1->show($totalnb ? 0 : 1);
|
||||||
}
|
}
|
||||||
$stringtoprint .= '</div>';
|
$stringtoprint .= '</div>';
|
||||||
$this->info_box_contents[][]=array(
|
$this->info_box_contents[][] = array(
|
||||||
'td' => 'class="center"',
|
'td' => 'class="center"',
|
||||||
'text' => $stringtoprint
|
'text' => $stringtoprint
|
||||||
);
|
);
|
||||||
|
|||||||
@ -508,16 +508,16 @@ function getNumberInvoicesPieChart($mode)
|
|||||||
|
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$dataseries = array(array($langs->trans('InvoiceLate30Days'),$obj->nblate30)
|
$dataseries = array(array($langs->trans('InvoiceLate30Days'), $obj->nblate30)
|
||||||
,array($langs->trans('InvoiceLate15Days'),$obj->nblate15-$obj->nblate30)
|
,array($langs->trans('InvoiceLate15Days'), $obj->nblate15 - $obj->nblate30)
|
||||||
,array($langs->trans('InvoiceLateMinus15Days'),$obj->nblatenow-$obj->nblate15)
|
,array($langs->trans('InvoiceLateMinus15Days'), $obj->nblatenow - $obj->nblate15)
|
||||||
,array($langs->trans('InvoiceNotLate'),$obj->nbnotlatenow-$obj->nbnotlate15)
|
,array($langs->trans('InvoiceNotLate'), $obj->nbnotlatenow - $obj->nbnotlate15)
|
||||||
,array($langs->trans('InvoiceNotLate15Days'),$obj->nbnotlate15-$obj->nbnotlate30)
|
,array($langs->trans('InvoiceNotLate15Days'), $obj->nbnotlate15 - $obj->nbnotlate30)
|
||||||
,array($langs->trans('InvoiceNotLate30Days'),$obj->nbnotlate30));
|
,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30));
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
foreach ($dataseries as $key=>$value) {
|
foreach ($dataseries as $key=>$value) {
|
||||||
$total+=$value[1];
|
$total += $value[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$colorseries = array($badgeStatus8, $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus11, '-'.$badgeStatus11);
|
$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 .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
|
||||||
$sql .= " cc.rowid, cc.code";
|
$sql .= " cc.rowid, cc.code";
|
||||||
if (!$user->rights->societe->client->voir && !$socid) {
|
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
|
// Add Group from hooks
|
||||||
|
|||||||
@ -3401,8 +3401,8 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||||||
$sql .= ", pu_ttc = ".price2num($this->pu_ttc);
|
$sql .= ", pu_ttc = ".price2num($this->pu_ttc);
|
||||||
$sql .= ", qty = ".price2num($this->qty);
|
$sql .= ", qty = ".price2num($this->qty);
|
||||||
$sql .= ", remise_percent = ".price2num($this->remise_percent);
|
$sql .= ", remise_percent = ".price2num($this->remise_percent);
|
||||||
if ($this->fk_remise_except) $sql.= ", fk_remise_except=".((int) $this->fk_remise_except);
|
if ($this->fk_remise_except) $sql .= ", fk_remise_except=".((int) $this->fk_remise_except);
|
||||||
else $sql.= ", fk_remise_except=null";
|
else $sql .= ", fk_remise_except=null";
|
||||||
$sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'";
|
$sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'";
|
||||||
$sql .= ", tva_tx = ".price2num($this->tva_tx);
|
$sql .= ", tva_tx = ".price2num($this->tva_tx);
|
||||||
$sql .= ", localtax1_tx = ".price2num($this->localtax1_tx);
|
$sql .= ", localtax1_tx = ".price2num($this->localtax1_tx);
|
||||||
@ -3633,7 +3633,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||||||
if ($discount->fk_facture_line > 0) {
|
if ($discount->fk_facture_line > 0) {
|
||||||
if (empty($noerrorifdiscountalreadylinked)) {
|
if (empty($noerrorifdiscountalreadylinked)) {
|
||||||
$this->error = $langs->trans("ErrorDiscountAlreadyUsed", $discount->id);
|
$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();
|
$this->db->rollback();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
@ -3641,20 +3641,20 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||||||
$result = $discount->link_to_invoice($this->rowid, 0);
|
$result = $discount->link_to_invoice($this->rowid, 0);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->error = $discount->error;
|
$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();
|
$this->db->rollback();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded");
|
$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();
|
$this->db->rollback();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->error = $discount->error;
|
$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();
|
$this->db->rollback();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class PartnershipUtils
|
|||||||
{
|
{
|
||||||
public $db; //!< To store db handler
|
public $db; //!< To store db handler
|
||||||
public $error; //!< To return error code (or message)
|
public $error; //!< To return error code (or message)
|
||||||
public $errors=array(); //!< To return several error codes (or messages)
|
public $errors = array(); //!< To return several error codes (or messages)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,9 +81,9 @@ class PartnershipUtils
|
|||||||
$this->error = '';
|
$this->error = '';
|
||||||
$partnershipsprocessed = array();
|
$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) {
|
if ($gracedelay < 1) {
|
||||||
$this->error='BadValueForDelayBeforeCancelCheckSetup';
|
$this->error = 'BadValueForDelayBeforeCancelCheckSetup';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ class PartnershipUtils
|
|||||||
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
if ($obj) {
|
if ($obj) {
|
||||||
if (! empty($partnershipsprocessed[$obj->rowid])) continue;
|
if (!empty($partnershipsprocessed[$obj->rowid])) continue;
|
||||||
|
|
||||||
if ($somethingdoneonpartnership >= $MAXPERCALL) {
|
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);
|
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 $this->errors = $object->errors;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$partnershipsprocessed[$object->id]=$object->ref;
|
$partnershipsprocessed[$object->id] = $object->ref;
|
||||||
|
|
||||||
// Send an email to inform member
|
// Send an email to inform member
|
||||||
$labeltemplate = '(SendingEmailOnPartnershipCanceled)';
|
$labeltemplate = '(SendingEmailOnPartnershipCanceled)';
|
||||||
@ -152,21 +152,21 @@ class PartnershipUtils
|
|||||||
// Send deployment email
|
// Send deployment email
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.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
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
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 = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$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);
|
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||||
|
|
||||||
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
|
$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);
|
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1);
|
||||||
$result = $cmail->sendfile();
|
$result = $cmail->sendfile();
|
||||||
if (! $result || $cmail->error) {
|
if (!$result || $cmail->error) {
|
||||||
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
|
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
|
||||||
$this->errors[] = $cmail->error;
|
$this->errors[] = $cmail->error;
|
||||||
if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
|
if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
|
||||||
@ -193,18 +193,18 @@ class PartnershipUtils
|
|||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (!$error) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
$this->output = $numofexpiredmembers.' expired partnership members found'."\n";
|
$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 {
|
} else {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->output = "Rollback after error\n";
|
$this->output = "Rollback after error\n";
|
||||||
$this->output.= $numofexpiredmembers.' expired partnership members found'."\n";
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($error ? 1: 0);
|
return ($error ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -232,9 +232,9 @@ class PartnershipUtils
|
|||||||
$this->error = '';
|
$this->error = '';
|
||||||
$partnershipsprocessed = array();
|
$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) {
|
if ($gracedelay < 1) {
|
||||||
$this->error='BadValueForDelayBeforeCancelCheckSetup';
|
$this->error = 'BadValueForDelayBeforeCancelCheckSetup';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ class PartnershipUtils
|
|||||||
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
if ($obj) {
|
if ($obj) {
|
||||||
if (! empty($partnershipsprocessed[$obj->rowid])) continue;
|
if (!empty($partnershipsprocessed[$obj->rowid])) continue;
|
||||||
|
|
||||||
if ($somethingdoneonpartnership >= $MAXPERCALL) {
|
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);
|
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
|
// Send deployment email
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.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
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
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 = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$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);
|
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||||
|
|
||||||
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
|
$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);
|
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1);
|
||||||
$result = $cmail->sendfile();
|
$result = $cmail->sendfile();
|
||||||
if (! $result || $cmail->error) {
|
if (!$result || $cmail->error) {
|
||||||
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
|
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
|
||||||
$this->errors[] = $cmail->error;
|
$this->errors[] = $cmail->error;
|
||||||
if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
|
if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
|
||||||
@ -360,7 +360,7 @@ class PartnershipUtils
|
|||||||
$object->reason_decline_or_cancel = '';
|
$object->reason_decline_or_cancel = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$partnershipsprocessed[$object->id]=$object->ref;
|
$partnershipsprocessed[$object->id] = $object->ref;
|
||||||
|
|
||||||
$object->last_check_backlink = $this->db->idate($now);
|
$object->last_check_backlink = $this->db->idate($now);
|
||||||
|
|
||||||
@ -372,22 +372,22 @@ class PartnershipUtils
|
|||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (!$error) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
$this->output = $numofexpiredmembers.' partnership checked'."\n";
|
$this->output = $numofexpiredmembers.' partnership checked'."\n";
|
||||||
if ($erroremail) $this->output.='. Got errors when sending some email : '.$erroremail."\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 ($emailnotfound) $this->output .= '. Email not found for some partner : '.$emailnotfound."\n";
|
||||||
if ($websitenotfound) $this->output.='. Website not found for some partner : '.$websitenotfound."\n";
|
if ($websitenotfound) $this->output .= '. Website not found for some partner : '.$websitenotfound."\n";
|
||||||
} else {
|
} else {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->output = "Rollback after error\n";
|
$this->output = "Rollback after error\n";
|
||||||
$this->output.= $numofexpiredmembers.' partnership checked'."\n";
|
$this->output .= $numofexpiredmembers.' partnership checked'."\n";
|
||||||
if ($erroremail) $this->output.='. Got errors when sending some email : '.$erroremail."\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 ($emailnotfound) $this->output .= '. Email not found for some partner : '.$emailnotfound."\n";
|
||||||
if ($websitenotfound) $this->output.='. Website not found for some partner : '.$websitenotfound."\n";
|
if ($websitenotfound) $this->output .= '. Website not found for some partner : '.$websitenotfound."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($error ? 1: 0);
|
return ($error ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -305,13 +305,13 @@ foreach ($search as $key => $val) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
|
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('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
|
||||||
if (preg_match('/_dtstart$/', $key)) {
|
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)) {
|
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 : '').'">';
|
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
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);
|
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);
|
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
|
||||||
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||||
|
|||||||
@ -1620,10 +1620,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
$tooltip .= $langs->trans("GenericMaskCodes5");
|
$tooltip .= $langs->trans("GenericMaskCodes5");
|
||||||
print '<tr><td id="mask_option">'.$langs->trans("ManageLotMask").'</td>';
|
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') {
|
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') {
|
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_lot = $conf->global->LOT_ADVANCED_MASK;
|
||||||
$inherited_mask_sn = $conf->global->SN_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);
|
$formbarcode = new FormBarCode($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fk_barcode_type='';
|
$fk_barcode_type = '';
|
||||||
if ($action == 'editbarcodetype') {
|
if ($action == 'editbarcodetype') {
|
||||||
print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type');
|
print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type');
|
||||||
$fk_barcode_type = $object->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 '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
|
||||||
print $object->getLibStatut(0, 2);
|
print $object->getLibStatut(0, 2);
|
||||||
print '</td></tr>';
|
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))) {
|
|| ($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 '<tr><td>'.$langs->trans("ManageLotMask").'</td><td>';
|
||||||
print $object->batch_mask;
|
print $object->batch_mask;
|
||||||
|
|||||||
@ -648,7 +648,7 @@ if ($action == 'create') {
|
|||||||
$sql .= " AND ps.fk_entrepot = ".((int) $object->id);
|
$sql .= " AND ps.fk_entrepot = ".((int) $object->id);
|
||||||
|
|
||||||
if ($separatedPMP) {
|
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);
|
$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/salary.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.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
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("compta", "salaries", "bills", "hrm"));
|
$langs->loadLangs(array("compta", "salaries", "bills", "hrm"));
|
||||||
@ -52,8 +54,12 @@ if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST(
|
|||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (!$sortfield) $sortfield = "s.datep,s.rowid";
|
if (!$sortfield) {
|
||||||
if (!$sortorder) $sortorder = "DESC,DESC";
|
$sortfield = "s.datep,s.rowid";
|
||||||
|
}
|
||||||
|
if (!$sortorder) {
|
||||||
|
$sortorder = "DESC,DESC";
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize technical objects
|
// Initialize technical objects
|
||||||
$object = new PaymentSalary($db);
|
$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_');
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
|
|
||||||
if (!$sortfield) $sortfield = "s.datep,s.rowid";
|
if (!$sortfield) {
|
||||||
if (!$sortorder) $sortorder = "DESC,DESC";
|
$sortfield = "s.datep,s.rowid";
|
||||||
|
}
|
||||||
|
if (!$sortorder) {
|
||||||
|
$sortorder = "DESC,DESC";
|
||||||
|
}
|
||||||
|
|
||||||
$search_ref = GETPOST('search_ref', 'int');
|
$search_ref = GETPOST('search_ref', 'int');
|
||||||
$search_ref_salary = GETPOST('search_ref_salary', 'int');
|
$search_ref_salary = GETPOST('search_ref_salary', 'int');
|
||||||
@ -89,7 +99,9 @@ if (!GETPOST('search_type_id', 'int')) {
|
|||||||
$filterarray = explode('-', $newfiltre);
|
$filterarray = explode('-', $newfiltre);
|
||||||
foreach ($filterarray as $val) {
|
foreach ($filterarray as $val) {
|
||||||
$part = explode(':', $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 {
|
} else {
|
||||||
$search_type_id = GETPOST('search_type_id', 'int');
|
$search_type_id = GETPOST('search_type_id', 'int');
|
||||||
@ -133,7 +145,9 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
|
|||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$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)) {
|
if (empty($reshook)) {
|
||||||
// Selection of new fields
|
// 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 .= " ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql .= " WHERE u.rowid = sal.fk_user";
|
$sql .= " WHERE u.rowid = sal.fk_user";
|
||||||
$sql .= " AND s.entity IN (".getEntity('payment_salaries').")";
|
$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
|
// Search criteria
|
||||||
if ($search_ref) $sql .= " AND s.rowid=".((int) $search_ref);
|
if ($search_ref) {
|
||||||
if ($search_ref_salary) $sql .= " AND sal.rowid=".((int) $search_ref_salary);
|
$sql .= " AND s.rowid=".((int) $search_ref);
|
||||||
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_ref_salary) {
|
||||||
if ($search_date_start) $sql .= " AND s.datep >= '".$db->idate($search_date_start)."'";
|
$sql .= " AND sal.rowid=".((int) $search_ref_salary);
|
||||||
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_user) {
|
||||||
if ($search_dateep_end) $sql .= " AND sal.dateep <= '".$db->idate($search_dateep_end)."'";
|
$sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
|
||||||
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_label) {
|
||||||
if ($search_fk_bank) $sql .= " AND s.fk_bank=".((int) $search_fk_bank);
|
$sql .= natural_search(array('sal.label'), $search_label);
|
||||||
if ($search_chq_number) $sql .= natural_search(array('s.num_payment'), $search_chq_number);
|
}
|
||||||
|
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) {
|
if ($search_type_id > 0) {
|
||||||
$sql .= " AND s.fk_typepayment=".((int) $search_type_id);
|
$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))) {
|
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
|
||||||
$num = $nbtotalofrecords;
|
$num = $nbtotalofrecords;
|
||||||
} else {
|
} else {
|
||||||
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
|
if ($limit) {
|
||||||
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
@ -257,21 +299,51 @@ llxHeader('', $title, $help_url);
|
|||||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||||
|
|
||||||
$param = '';
|
$param = '';
|
||||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
$param .= '&contextpage='.urlencode($contextpage);
|
||||||
if ($search_type_id) $param .= '&search_type_id='.urlencode($search_type_id);
|
}
|
||||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
$param .= '&limit='.urlencode($limit);
|
||||||
if ($search_ref_salary) $param .= '&search_ref_salary='.urlencode($search_ref_salary);
|
}
|
||||||
if ($search_user) $param .= '&search_user='.urlencode($search_user);
|
if ($search_type_id) {
|
||||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
$param .= '&search_type_id='.urlencode($search_type_id);
|
||||||
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 ($optioncss != '') {
|
||||||
if ($search_account) $param .= '&search_account='.urlencode($search_account);
|
$param .= '&optioncss='.urlencode($optioncss);
|
||||||
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_ref) {
|
||||||
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'));
|
$param .= '&search_ref='.urlencode($search_ref);
|
||||||
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 ($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
|
// Add $param from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
|
||||||
@ -281,11 +353,15 @@ $arrayofmassactions = array(
|
|||||||
//'buildsepa'=>$langs->trans("BuildSepa"), // TODO
|
//'buildsepa'=>$langs->trans("BuildSepa"), // TODO
|
||||||
);
|
);
|
||||||
//if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
//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);
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
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="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="action" 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.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
$url = DOL_URL_ROOT.'/salaries/card.php?action=create';
|
$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);
|
$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);
|
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;
|
$needToFetchEachLine = 0;
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 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) {
|
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();
|
$totalarray = array();
|
||||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if (empty($obj)) break; // Should not happen
|
if (empty($obj)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Should not happen
|
||||||
|
|
||||||
// Store properties in $object
|
// Store properties in $object
|
||||||
$object->setVarsFromFetchObj($obj);
|
$object->setVarsFromFetchObj($obj);
|
||||||
@ -449,22 +533,32 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print "<td>".$paymentsalstatic->getNomUrl(1)."</td>\n";
|
print "<td>".$paymentsalstatic->getNomUrl(1)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Label payment
|
// Label payment
|
||||||
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Date end period
|
// Date end period
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->dateep), 'day')."</td>\n";
|
print '<td class="center">'.dol_print_date($db->jdate($obj->dateep), 'day')."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
|
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Date value
|
// Date value
|
||||||
/*print '<td class="center">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";
|
/*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
|
// Employee
|
||||||
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
|
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).'</td>';
|
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).'</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Chq number
|
// Chq number
|
||||||
print '<td>'.$obj->num_payment.'</td>';
|
print '<td>'.$obj->num_payment.'</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Account
|
// Account
|
||||||
if (!empty($conf->banque->enabled)) {
|
if (!empty($conf->banque->enabled)) {
|
||||||
@ -489,7 +589,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|||||||
$accountlinestatic->id = $obj->fk_bank;
|
$accountlinestatic->id = $obj->fk_bank;
|
||||||
print $accountlinestatic->getNomUrl(1);
|
print $accountlinestatic->getNomUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($obj->fk_bank > 0) {
|
if ($obj->fk_bank > 0) {
|
||||||
@ -514,15 +616,23 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|||||||
if ($accountstatic->id > 0) {
|
if ($accountstatic->id > 0) {
|
||||||
print $accountstatic->getNomUrl(1);
|
print $accountstatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
} else print ' ';
|
} else {
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<td class="nowrap right"><span class="amount">'.price($obj->amount).'</span></td>';
|
print '<td class="nowrap right"><span class="amount">'.price($obj->amount).'</span></td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
|
||||||
|
}
|
||||||
$totalarray['val']['totalttcfield'] += $obj->amount;
|
$totalarray['val']['totalttcfield'] += $obj->amount;
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
@ -535,11 +645,15 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|||||||
print '<td class="nowrap center">';
|
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
|
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;
|
$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 '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
@ -553,7 +667,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
|||||||
// If no record found
|
// If no record found
|
||||||
if ($num == 0) {
|
if ($num == 0) {
|
||||||
$colspan = 1;
|
$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>';
|
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';
|
require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("companies","partnership", "other"));
|
$langs->loadLangs(array("companies", "partnership", "other"));
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
@ -91,10 +91,18 @@ $usercanclose = $user->rights->partnership->write; // Used by the include of
|
|||||||
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
|
$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->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'thirdparty') {
|
||||||
if (empty($conf->partnership->enabled)) accessforbidden();
|
accessforbidden();
|
||||||
if (empty($permissiontoread)) accessforbidden();
|
}
|
||||||
if ($action == 'edit' && empty($permissiontoadd)) 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)) {
|
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT && !empty($user->socid)) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -128,7 +136,9 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$object->fields['fk_soc']['visible'] = 0;
|
$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;
|
$object->fields['note_public']['visible'] = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user