Merge pull request #15833 from frederic34/paymentsalary
add $fields in paymentsalary class
This commit is contained in:
commit
03c4e3ecae
@ -238,18 +238,18 @@ if ($action == 'create') {
|
|||||||
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200');
|
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Category
|
|
||||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Chart of accounts type
|
// Chart of accounts type
|
||||||
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Category
|
||||||
|
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
@ -300,18 +300,18 @@ if ($action == 'create') {
|
|||||||
print $formaccounting->select_account($object->account_parent, 'account_parent', 1);
|
print $formaccounting->select_account($object->account_parent, 'account_parent', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Category
|
|
||||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Chart of accounts type
|
// Chart of accounts type
|
||||||
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Category
|
||||||
|
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|||||||
@ -78,7 +78,7 @@ $form = new Form($db);
|
|||||||
if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
|
if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
|
||||||
{
|
{
|
||||||
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||||
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
|
$sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
|
||||||
$sql .= $db->plimit(1);
|
$sql .= $db->plimit(1);
|
||||||
$res = $db->query($sql);
|
$res = $db->query($sql);
|
||||||
if ($res->num_rows > 0) {
|
if ($res->num_rows > 0) {
|
||||||
@ -242,10 +242,12 @@ if ($action != 'export_csv')
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$colspan = (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE) ? 5 : 4);
|
||||||
|
|
||||||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre" colspan="5">';
|
print '<td class="liste_titre" colspan="'.$colspan.'">';
|
||||||
print $langs->trans('From');
|
print $langs->trans('From');
|
||||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
||||||
print ' ';
|
print ' ';
|
||||||
@ -261,7 +263,7 @@ if ($action != 'export_csv')
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||||
@ -278,22 +280,30 @@ if ($action != 'export_csv')
|
|||||||
|
|
||||||
$accountingaccountstatic = new AccountingAccount($db);
|
$accountingaccountstatic = new AccountingAccount($db);
|
||||||
|
|
||||||
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
|
// TODO Debug - This feature is dangerous, it takes all the entries and adds all the accounts
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
|
// without time and class limits (Class 6 and 7 accounts ???) and does not take into account the "a-nouveau" journal.
|
||||||
$sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||||
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'";
|
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
|
||||||
$sql .= " GROUP BY t.numero_compte";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||||
|
$sql .= " WHERE t.entity = " . $conf->entity; // Never do sharing into accounting features
|
||||||
|
$sql .= " AND t.doc_date < '" . $db->idate($search_date_start) . "'";
|
||||||
|
$sql .= " GROUP BY t.numero_compte";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$nrows = $resql->num_rows;
|
$nrows = $resql->num_rows;
|
||||||
$opening_balances = array();
|
$opening_balances = array();
|
||||||
for ($i = 0; $i < $nrows; $i++) {
|
for ($i = 0; $i < $nrows; $i++) {
|
||||||
$arr = $resql->fetch_array();
|
$arr = $resql->fetch_array();
|
||||||
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
|
$opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($object->lines as $line)
|
foreach ($object->lines as $line)
|
||||||
{
|
{
|
||||||
|
// reset before the fetch (in case of the fetch fails)
|
||||||
|
$accountingaccountstatic->id = 0;
|
||||||
|
$accountingaccountstatic->account_number = '';
|
||||||
|
|
||||||
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
|
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
|
||||||
if (!empty($accountingaccountstatic->account_number)) {
|
if (!empty($accountingaccountstatic->account_number)) {
|
||||||
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
|
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
|
||||||
@ -311,8 +321,8 @@ if ($action != 'export_csv')
|
|||||||
$root_account_description = $tmparrayforrootaccount['label'];
|
$root_account_description = $tmparrayforrootaccount['label'];
|
||||||
$root_account_number = $tmparrayforrootaccount['account_number'];
|
$root_account_number = $tmparrayforrootaccount['account_number'];
|
||||||
|
|
||||||
if (empty($accountingaccountstatic->account_number)) {
|
if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>';
|
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=update&token='.newToken().'&id='.$accountingaccountstatic->id.'">'.img_edit().'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($show_subgroup))
|
if (!empty($show_subgroup))
|
||||||
@ -322,17 +332,22 @@ if ($action != 'export_csv')
|
|||||||
// Show subtotal per accounting account
|
// Show subtotal per accounting account
|
||||||
if ($displayed_account != "") {
|
if ($displayed_account != "") {
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td class="right" colspan="2">'.$langs->trans("SubTotal").':</td>';
|
print '<td class="right">'.$langs->trans("SubTotal").':</td>';
|
||||||
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($sous_total_opening_balance).'</td>';
|
||||||
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||||
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||||
print '<td class="nowrap right">'.price(price2num($sous_total_opening_balance + $sous_total_credit - $sous_total_debit)).'</td>';
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||||
|
print '<td class="nowrap right">'.price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit)).'</td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
|
||||||
|
}
|
||||||
print "<td></td>\n";
|
print "<td></td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show first line of a break
|
// Show first line of a break
|
||||||
print '<tr class="trforbreak">';
|
print '<tr class="trforbreak">';
|
||||||
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$displayed_account = $root_account_number;
|
$displayed_account = $root_account_number;
|
||||||
@ -344,10 +359,14 @@ if ($action != 'export_csv')
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$accounting_account.'</td>';
|
print '<td>'.$accounting_account.'</td>';
|
||||||
print '<td class="nowraponall right">'.price($opening_balance).'</td>';
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowraponall right">'.price($opening_balance).'</td>';
|
||||||
print '<td class="nowraponall right">'.price($line->debit).'</td>';
|
print '<td class="nowraponall right">'.price($line->debit).'</td>';
|
||||||
print '<td class="nowraponall right">'.price($line->credit).'</td>';
|
print '<td class="nowraponall right">'.price($line->credit).'</td>';
|
||||||
print '<td class="nowraponall right">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>';
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||||
|
print '<td class="nowraponall right">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="nowraponall right">'.price(price2num($line->debit - $line->credit, 'MT')).'</td>';
|
||||||
|
}
|
||||||
print '<td class="center">'.$link;
|
print '<td class="center">'.$link;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -360,12 +379,28 @@ if ($action != 'export_csv')
|
|||||||
|
|
||||||
if (!empty($show_subgroup))
|
if (!empty($show_subgroup))
|
||||||
{
|
{
|
||||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')).'</td>';
|
print '<tr class="liste_total"><td class="right">'.$langs->trans("SubTotal").':</td>';
|
||||||
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($sous_total_opening_balance).'</td>';
|
||||||
|
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||||
|
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||||
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||||
|
print '<td class="nowrap right">' . price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="nowrap right">' . price(price2num($sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
|
||||||
|
}
|
||||||
print "<td></td>\n";
|
print "<td></td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')).'</td>';
|
print '<tr class="liste_total"><td class="right">'.$langs->trans("AccountBalance").':</td>';
|
||||||
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($total_opening_balance).'</td>';
|
||||||
|
print '<td class="nowrap right">'.price($total_debit).'</td>';
|
||||||
|
print '<td class="nowrap right">'.price($total_credit).'</td>';
|
||||||
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||||
|
print '<td class="nowrap right">' . price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')) . '</td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="nowrap right">' . price(price2num($total_debit - $total_credit, 'MT')) . '</td>';
|
||||||
|
}
|
||||||
print "<td></td>\n";
|
print "<td></td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|||||||
@ -251,7 +251,7 @@ PaymentsNotLinkedToProduct=Payment not linked to any product / service
|
|||||||
OpeningBalance=Opening balance
|
OpeningBalance=Opening balance
|
||||||
ShowOpeningBalance=Show opening balance
|
ShowOpeningBalance=Show opening balance
|
||||||
HideOpeningBalance=Hide opening balance
|
HideOpeningBalance=Hide opening balance
|
||||||
ShowSubtotalByGroup=Show subtotal by group
|
ShowSubtotalByGroup=Show subtotal by level
|
||||||
|
|
||||||
Pcgtype=Group of account
|
Pcgtype=Group of account
|
||||||
PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' criteria for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as groups for accounting accounts of products to build the expense/income report.
|
PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' criteria for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as groups for accounting accounts of products to build the expense/income report.
|
||||||
|
|||||||
@ -88,6 +88,10 @@ class PaymentSalary extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $fk_user_modif;
|
public $fk_user_modif;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||||
|
*/
|
||||||
|
public $fields = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -120,8 +124,7 @@ class PaymentSalary extends CommonObject
|
|||||||
$this->note = trim($this->note);
|
$this->note = trim($this->note);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($this->fk_user) || $this->fk_user < 0)
|
if (empty($this->fk_user) || $this->fk_user < 0) {
|
||||||
{
|
|
||||||
$this->error = 'ErrorBadParameter';
|
$this->error = 'ErrorBadParameter';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -151,35 +154,29 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql)
|
if (!$resql) {
|
||||||
{
|
|
||||||
$this->error = "Error ".$this->db->lasterror();
|
$this->error = "Error ".$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
$result = $this->insertExtraFields();
|
||||||
if (!$error)
|
if ($result < 0) {
|
||||||
{
|
$error++;
|
||||||
$result = $this->insertExtraFields();
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$notrigger)
|
if (!$notrigger) {
|
||||||
{
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('PAYMENT_SALARY_MODIFY', $user);
|
$result = $this->call_trigger('PAYMENT_SALARY_MODIFY', $user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
@ -227,26 +224,24 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
if ($this->db->num_rows($resql)) {
|
||||||
if ($this->db->num_rows($resql))
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->rowid;
|
$this->ref = $obj->rowid;
|
||||||
$this->tms = $this->db->jdate($obj->tms);
|
$this->tms = $this->db->jdate($obj->tms);
|
||||||
$this->fk_user = $obj->fk_user;
|
$this->fk_user = $obj->fk_user;
|
||||||
$this->datep = $this->db->jdate($obj->datep);
|
$this->datep = $this->db->jdate($obj->datep);
|
||||||
$this->datev = $this->db->jdate($obj->datev);
|
$this->datev = $this->db->jdate($obj->datev);
|
||||||
$this->amount = $obj->amount;
|
$this->amount = $obj->amount;
|
||||||
$this->fk_project = $obj->fk_project;
|
$this->fk_project = $obj->fk_project;
|
||||||
$this->type_payement = $obj->fk_typepayment;
|
$this->type_payement = $obj->fk_typepayment;
|
||||||
$this->num_payment = $obj->num_payment;
|
$this->num_payment = $obj->num_payment;
|
||||||
$this->label = $obj->label;
|
$this->label = $obj->label;
|
||||||
$this->datesp = $this->db->jdate($obj->datesp);
|
$this->datesp = $this->db->jdate($obj->datesp);
|
||||||
$this->dateep = $this->db->jdate($obj->dateep);
|
$this->dateep = $this->db->jdate($obj->dateep);
|
||||||
$this->note = $obj->note;
|
$this->note = $obj->note;
|
||||||
$this->fk_bank = $obj->fk_bank;
|
$this->fk_bank = $obj->fk_bank;
|
||||||
$this->fk_user_author = $obj->fk_user_author;
|
$this->fk_user_author = $obj->fk_user_author;
|
||||||
$this->fk_user_modif = $obj->fk_user_modif;
|
$this->fk_user_modif = $obj->fk_user_modif;
|
||||||
@ -282,18 +277,18 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('PAYMENT_SALARY_DELETE', $user);
|
$result = $this->call_trigger('PAYMENT_SALARY_DELETE', $user);
|
||||||
if ($result < 0) return -1;
|
if ($result < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|
||||||
// Delete donation
|
// Delete donation
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary_extrafields";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary_extrafields";
|
||||||
$sql .= " WHERE fk_object=".$this->id;
|
$sql .= " WHERE fk_object=".$this->id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql)
|
if (!$resql) {
|
||||||
{
|
|
||||||
$this->errors[] = $this->db->lasterror();
|
$this->errors[] = $this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -304,8 +299,7 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql)
|
if (!$resql) {
|
||||||
{
|
|
||||||
$this->error = "Error ".$this->db->lasterror();
|
$this->error = "Error ".$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -326,7 +320,7 @@ class PaymentSalary extends CommonObject
|
|||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
|
|
||||||
$this->tms = '';
|
$this->tms = '';
|
||||||
$this->fk_user = '';
|
$this->fk_user = 1;
|
||||||
$this->datep = '';
|
$this->datep = '';
|
||||||
$this->datev = '';
|
$this->datev = '';
|
||||||
$this->amount = '';
|
$this->amount = '';
|
||||||
@ -335,8 +329,8 @@ class PaymentSalary extends CommonObject
|
|||||||
$this->dateep = '';
|
$this->dateep = '';
|
||||||
$this->note = '';
|
$this->note = '';
|
||||||
$this->fk_bank = '';
|
$this->fk_bank = '';
|
||||||
$this->fk_user_author = '';
|
$this->fk_user_author = 1;
|
||||||
$this->fk_user_modif = '';
|
$this->fk_user_modif = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -356,34 +350,29 @@ class PaymentSalary extends CommonObject
|
|||||||
$this->amount = price2num(trim($this->amount));
|
$this->amount = price2num(trim($this->amount));
|
||||||
$this->label = trim($this->label);
|
$this->label = trim($this->label);
|
||||||
$this->note = trim($this->note);
|
$this->note = trim($this->note);
|
||||||
$this->fk_bank = trim($this->fk_bank);
|
$this->fk_bank = (int) $this->fk_bank;
|
||||||
$this->fk_user_author = trim($this->fk_user_author);
|
$this->fk_user_author = (int) $this->fk_user_author;
|
||||||
$this->fk_user_modif = trim($this->fk_user_modif);
|
$this->fk_user_modif = (int) $this->fk_user_modif;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (!$this->label)
|
if (!$this->label) {
|
||||||
{
|
$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
|
||||||
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
|
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
if ($this->fk_user < 0 || $this->fk_user == '')
|
if ($this->fk_user <= 0 || $this->fk_user == '') {
|
||||||
{
|
$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Employee"));
|
||||||
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Employee"));
|
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
if ($this->amount < 0 || $this->amount == '')
|
if ($this->amount < 0 || $this->amount == '') {
|
||||||
{
|
$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
|
||||||
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
|
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
if (!empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0))
|
if (!empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0)) {
|
||||||
{
|
$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Account"));
|
||||||
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Account"));
|
|
||||||
return -6;
|
return -6;
|
||||||
}
|
}
|
||||||
if (!empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0))
|
if (!empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0)) {
|
||||||
{
|
$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
|
||||||
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
|
|
||||||
return -7;
|
return -7;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +387,9 @@ class PaymentSalary extends CommonObject
|
|||||||
$sql .= ", salary";
|
$sql .= ", salary";
|
||||||
$sql .= ", fk_typepayment";
|
$sql .= ", fk_typepayment";
|
||||||
$sql .= ", num_payment";
|
$sql .= ", num_payment";
|
||||||
if ($this->note) $sql .= ", note";
|
if ($this->note) {
|
||||||
|
$sql .= ", note";
|
||||||
|
}
|
||||||
$sql .= ", label";
|
$sql .= ", label";
|
||||||
$sql .= ", datesp";
|
$sql .= ", datesp";
|
||||||
$sql .= ", dateep";
|
$sql .= ", dateep";
|
||||||
@ -416,7 +407,9 @@ class PaymentSalary extends CommonObject
|
|||||||
$sql .= ", ".($this->salary > 0 ? $this->salary : "null");
|
$sql .= ", ".($this->salary > 0 ? $this->salary : "null");
|
||||||
$sql .= ", ".$this->db->escape($this->type_payment);
|
$sql .= ", ".$this->db->escape($this->type_payment);
|
||||||
$sql .= ", '".$this->db->escape($this->num_payment)."'";
|
$sql .= ", '".$this->db->escape($this->num_payment)."'";
|
||||||
if ($this->note) $sql .= ", '".$this->db->escape($this->note)."'";
|
if ($this->note) {
|
||||||
|
$sql .= ", '".$this->db->escape($this->note)."'";
|
||||||
|
}
|
||||||
$sql .= ", '".$this->db->escape($this->label)."'";
|
$sql .= ", '".$this->db->escape($this->label)."'";
|
||||||
$sql .= ", '".$this->db->idate($this->datesp)."'";
|
$sql .= ", '".$this->db->idate($this->datesp)."'";
|
||||||
$sql .= ", '".$this->db->idate($this->dateep)."'";
|
$sql .= ", '".$this->db->idate($this->dateep)."'";
|
||||||
@ -428,30 +421,25 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary");
|
||||||
|
|
||||||
if ($this->id > 0)
|
if ($this->id > 0) {
|
||||||
{
|
if (!empty($conf->banque->enabled) && !empty($this->amount)) {
|
||||||
if (!empty($conf->banque->enabled) && !empty($this->amount))
|
|
||||||
{
|
|
||||||
// Insert into llx_bank
|
// Insert into llx_bank
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
|
||||||
$acc = new Account($this->db);
|
$acc = new Account($this->db);
|
||||||
$result = $acc->fetch($this->accountid);
|
$result = $acc->fetch($this->accountid);
|
||||||
if ($result <= 0) dol_print_error($this->db);
|
if ($result <= 0) {
|
||||||
|
dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
if (!$error)
|
$result = $this->insertExtraFields();
|
||||||
{
|
if ($result < 0) {
|
||||||
$result = $this->insertExtraFields();
|
$error++;
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,22 +461,19 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
// Update fk_bank into llx_paiement.
|
// Update fk_bank into llx_paiement.
|
||||||
// So we know the payment which has generate the banking ecriture
|
// So we know the payment which has generate the banking ecriture
|
||||||
if ($bank_line_id > 0)
|
if ($bank_line_id > 0) {
|
||||||
{
|
|
||||||
$this->update_fk_bank($bank_line_id);
|
$this->update_fk_bank($bank_line_id);
|
||||||
} else {
|
} else {
|
||||||
$this->error = $acc->error;
|
$this->error = $acc->error;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
||||||
$url = DOL_URL_ROOT.'/salaries/card.php?id=';
|
$url = DOL_URL_ROOT.'/salaries/card.php?id=';
|
||||||
|
|
||||||
$result = $acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary");
|
$result = $acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary");
|
||||||
if ($result <= 0)
|
if ($result <= 0) {
|
||||||
{
|
|
||||||
$this->error = $acc->error;
|
$this->error = $acc->error;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -507,8 +492,7 @@ class PaymentSalary extends CommonObject
|
|||||||
'user'
|
'user'
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result <= 0)
|
if ($result <= 0) {
|
||||||
{
|
|
||||||
$this->error = $acc->error;
|
$this->error = $acc->error;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -516,12 +500,15 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('PAYMENT_SALARY_CREATE', $user);
|
$result = $this->call_trigger('PAYMENT_SALARY_CREATE', $user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
} else $error++;
|
} else {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
} else {
|
} else {
|
||||||
@ -548,8 +535,7 @@ class PaymentSalary extends CommonObject
|
|||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank;
|
||||||
$sql .= ' WHERE rowid = '.$this->id;
|
$sql .= ' WHERE rowid = '.$this->id;
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
@ -574,7 +560,9 @@ class PaymentSalary extends CommonObject
|
|||||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||||
global $menumanager;
|
global $menumanager;
|
||||||
|
|
||||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
if (!empty($conf->dol_no_mouse_hover)) {
|
||||||
|
$notooltip = 1; // Force disable tooltips
|
||||||
|
}
|
||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
@ -583,10 +571,11 @@ class PaymentSalary extends CommonObject
|
|||||||
if (!empty($this->label)) {
|
if (!empty($this->label)) {
|
||||||
$labeltoshow = $this->label;
|
$labeltoshow = $this->label;
|
||||||
$reg = array();
|
$reg = array();
|
||||||
if (preg_match('/^\((.*)\)$/i', $this->label, $reg))
|
if (preg_match('/^\((.*)\)$/i', $this->label, $reg)) {
|
||||||
{
|
|
||||||
// Label generique car entre parentheses. On l'affiche en le traduisant
|
// Label generique car entre parentheses. On l'affiche en le traduisant
|
||||||
if ($reg[1] == 'paiement') $reg[1] = 'Payment';
|
if ($reg[1] == 'paiement') {
|
||||||
|
$reg[1] = 'Payment';
|
||||||
|
}
|
||||||
$labeltoshow = $langs->trans($reg[1]);
|
$labeltoshow = $langs->trans($reg[1]);
|
||||||
}
|
}
|
||||||
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
|
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
|
||||||
@ -594,19 +583,20 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
$url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id;
|
||||||
|
|
||||||
if ($option != 'nolink')
|
if ($option != 'nolink') {
|
||||||
{
|
|
||||||
// Add param to save lastsearch_values or not
|
// Add param to save lastsearch_values or not
|
||||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
|
||||||
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
$add_save_lastsearch_values = 1;
|
||||||
|
}
|
||||||
|
if ($add_save_lastsearch_values) {
|
||||||
|
$url .= '&save_lastsearch_values=1';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkclose = '';
|
$linkclose = '';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip)) {
|
||||||
{
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
|
||||||
{
|
|
||||||
$label = $langs->trans("ShowMyObject");
|
$label = $langs->trans("ShowMyObject");
|
||||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
@ -614,20 +604,26 @@ class PaymentSalary extends CommonObject
|
|||||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$hookmanager->initHooks(array('myobjectdao'));
|
$hookmanager->initHooks(array('myobjectdao'));
|
||||||
$parameters=array('id'=>$this->id);
|
$parameters=array('id'=>$this->id);
|
||||||
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
||||||
*/
|
*/
|
||||||
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
} else {
|
||||||
|
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||||
|
}
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'"';
|
$linkstart = '<a href="'.$url.'"';
|
||||||
$linkstart .= $linkclose.'>';
|
$linkstart .= $linkclose.'>';
|
||||||
$linkend = '</a>';
|
$linkend = '</a>';
|
||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
if ($withpicto) {
|
||||||
if ($withpicto != 2) $result .= $this->ref;
|
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||||
|
}
|
||||||
|
if ($withpicto != 2) {
|
||||||
|
$result .= $this->ref;
|
||||||
|
}
|
||||||
$result .= $linkend;
|
$result .= $linkend;
|
||||||
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||||
|
|
||||||
@ -635,8 +631,11 @@ class PaymentSalary extends CommonObject
|
|||||||
$hookmanager->initHooks(array('salarypayment'));
|
$hookmanager->initHooks(array('salarypayment'));
|
||||||
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
|
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
|
||||||
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook > 0) $result = $hookmanager->resPrint;
|
if ($reshook > 0) {
|
||||||
else $result .= $hookmanager->resPrint;
|
$result = $hookmanager->resPrint;
|
||||||
|
} else {
|
||||||
|
$result .= $hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -656,14 +655,11 @@ class PaymentSalary extends CommonObject
|
|||||||
dol_syslog(get_class($this).'::info', LOG_DEBUG);
|
dol_syslog(get_class($this).'::info', LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
if ($this->db->num_rows($result)) {
|
||||||
if ($this->db->num_rows($result))
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
if ($obj->fk_user_author)
|
if ($obj->fk_user_author) {
|
||||||
{
|
|
||||||
$cuser = new User($this->db);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch($obj->fk_user_author);
|
$cuser->fetch($obj->fk_user_author);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
@ -703,40 +699,40 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
$langs->load('compta');
|
$langs->load('compta');
|
||||||
/*if ($mode == 0)
|
/*if ($mode == 0)
|
||||||
{
|
{
|
||||||
if ($status == 0) return $langs->trans('ToValidate');
|
if ($status == 0) return $langs->trans('ToValidate');
|
||||||
if ($status == 1) return $langs->trans('Validated');
|
if ($status == 1) return $langs->trans('Validated');
|
||||||
}
|
}
|
||||||
if ($mode == 1)
|
if ($mode == 1)
|
||||||
{
|
{
|
||||||
if ($status == 0) return $langs->trans('ToValidate');
|
if ($status == 0) return $langs->trans('ToValidate');
|
||||||
if ($status == 1) return $langs->trans('Validated');
|
if ($status == 1) return $langs->trans('Validated');
|
||||||
}
|
}
|
||||||
if ($mode == 2)
|
if ($mode == 2)
|
||||||
{
|
{
|
||||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
|
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
|
||||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
|
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
|
||||||
}
|
}
|
||||||
if ($mode == 3)
|
if ($mode == 3)
|
||||||
{
|
{
|
||||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
|
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
|
||||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
|
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
|
||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
|
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
|
||||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
|
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
|
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
|
||||||
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
|
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
|
||||||
}
|
}
|
||||||
if ($mode == 6)
|
if ($mode == 6)
|
||||||
{
|
{
|
||||||
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
|
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
|
||||||
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
|
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
|
||||||
}*/
|
}*/
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,9 @@
|
|||||||
require '../main.inc.php';
|
require '../main.inc.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"));
|
||||||
@ -46,12 +48,18 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|||||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||||
$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);
|
||||||
@ -64,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_user = GETPOST('search_user', 'alpha');
|
$search_user = GETPOST('search_user', 'alpha');
|
||||||
@ -77,14 +89,14 @@ $search_account = GETPOST('search_account', 'int');
|
|||||||
|
|
||||||
$filtre = GETPOST("filtre", 'restricthtml');
|
$filtre = GETPOST("filtre", 'restricthtml');
|
||||||
|
|
||||||
if (!GETPOST('search_type_id', 'int'))
|
if (!GETPOST('search_type_id', 'int')) {
|
||||||
{
|
|
||||||
$newfiltre = str_replace('filtre=', '', $filtre);
|
$newfiltre = str_replace('filtre=', '', $filtre);
|
||||||
$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');
|
||||||
@ -94,22 +106,26 @@ $childids = $user->getAllChildIds(1);
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid", "int");
|
$socid = GETPOST("socid", "int");
|
||||||
if ($user->socid) $socid = $user->socid;
|
if ($user->socid) {
|
||||||
|
$socid = $user->socid;
|
||||||
|
}
|
||||||
$result = restrictedArea($user, 'salaries', '', '', '');
|
$result = restrictedArea($user, 'salaries', '', '', '');
|
||||||
|
|
||||||
// Initialize array of search criterias
|
// Initialize array of search criterias
|
||||||
$search_all = GETPOST("search_all", 'alpha');
|
$search_all = GETPOST("search_all", 'alpha');
|
||||||
$search = array();
|
$search = array();
|
||||||
foreach ($object->fields as $key => $val)
|
foreach ($object->fields as $key => $val) {
|
||||||
{
|
if (GETPOST('search_'.$key, 'alpha') !== '') {
|
||||||
if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
|
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
$fieldstosearchall = array();
|
$fieldstosearchall = array();
|
||||||
foreach ($object->fields as $key => $val)
|
foreach ($object->fields as $key => $val) {
|
||||||
{
|
if ($val['searchall']) {
|
||||||
if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
|
$fieldstosearchall['t.'.$key] = $val['label'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$permissiontoread = $user->rights->salaries->read;
|
$permissiontoread = $user->rights->salaries->read;
|
||||||
@ -121,21 +137,26 @@ $permissiontodelete = $user->rights->salaries->delete;
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
if (GETPOST('cancel', 'alpha')) {
|
||||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
$action = 'list';
|
||||||
|
$massaction = '';
|
||||||
|
}
|
||||||
|
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||||
|
$massaction = '';
|
||||||
|
}
|
||||||
|
|
||||||
$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
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
|
||||||
{
|
|
||||||
$search_ref = "";
|
$search_ref = "";
|
||||||
$search_user = "";
|
$search_user = "";
|
||||||
$search_label = "";
|
$search_label = "";
|
||||||
@ -146,8 +167,7 @@ if (empty($reshook))
|
|||||||
$search_type_id = "";
|
$search_type_id = "";
|
||||||
}
|
}
|
||||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||||
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
|
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
|
||||||
{
|
|
||||||
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,8 +178,7 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
|
|
||||||
// Validate records
|
// Validate records
|
||||||
if (!$error && $massaction == 'buildsepa' && $permissiontoadd)
|
if (!$error && $massaction == 'buildsepa' && $permissiontoadd) {
|
||||||
{
|
|
||||||
$objecttmp = new $objectclass($db);
|
$objecttmp = new $objectclass($db);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
@ -192,16 +211,32 @@ $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 = s.fk_user";
|
$sql .= " WHERE u.rowid = s.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 (".join(',', $childids).")";
|
if (empty($user->rights->salaries->readall)) {
|
||||||
|
$sql .= " AND s.fk_user IN (".join(',', $childids).")";
|
||||||
|
}
|
||||||
|
|
||||||
// Search criteria
|
// Search criteria
|
||||||
if ($search_ref) $sql .= " AND s.rowid=".((int) $search_ref);
|
if ($search_ref) {
|
||||||
if ($search_user) $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
|
$sql .= " AND s.rowid=".((int) $search_ref);
|
||||||
if ($search_label) $sql .= natural_search(array('s.label'), $search_label);
|
}
|
||||||
if ($search_date_start) $sql .= " AND s.datep >= '".$db->idate($search_date_start)."'";
|
if ($search_user) {
|
||||||
if ($search_date_end) $sql .= " AND s.datep <= '".$db->idate($search_date_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) {
|
||||||
|
$sql .= natural_search(array('s.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_amount) {
|
||||||
|
$sql .= natural_search("s.amount", $search_amount, 1);
|
||||||
|
}
|
||||||
|
if ($search_account > 0) {
|
||||||
|
$sql .= " AND b.fk_account=".((int) $search_account);
|
||||||
|
}
|
||||||
if ($filtre) {
|
if ($filtre) {
|
||||||
$filtre = str_replace(":", "=", $filtre);
|
$filtre = str_replace(":", "=", $filtre);
|
||||||
$sql .= " AND ".$filtre;
|
$sql .= " AND ".$filtre;
|
||||||
@ -213,26 +248,24 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
{
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($resql);
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
|
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||||
{
|
|
||||||
$page = 0;
|
$page = 0;
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||||
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) {
|
||||||
{
|
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -248,16 +281,36 @@ 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_user > 0) $param .= '&search_user='.urlencode($search_user);
|
}
|
||||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
if ($search_type_id) {
|
||||||
if ($search_account) $param .= '&search_account='.urlencode($search_account);
|
$param .= '&search_type_id='.urlencode($search_type_id);
|
||||||
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_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 ($optioncss != '') {
|
||||||
|
$param .= '&optioncss='.urlencode($optioncss);
|
||||||
|
}
|
||||||
|
if ($search_ref) {
|
||||||
|
$param .= '&search_ref='.urlencode($search_ref);
|
||||||
|
}
|
||||||
|
if ($search_user > 0) {
|
||||||
|
$param .= '&search_user='.urlencode($search_user);
|
||||||
|
}
|
||||||
|
if ($search_label) {
|
||||||
|
$param .= '&search_label='.urlencode($search_label);
|
||||||
|
}
|
||||||
|
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_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'));
|
||||||
|
}
|
||||||
// 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';
|
||||||
|
|
||||||
@ -267,11 +320,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">';
|
||||||
@ -280,7 +337,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);
|
||||||
@ -323,8 +382,7 @@ print '<td class="liste_titre left">';
|
|||||||
$form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16);
|
$form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Account
|
// Account
|
||||||
if (!empty($conf->banque->enabled))
|
if (!empty($conf->banque->enabled)) {
|
||||||
{
|
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
$form->select_comptes($search_account, 'search_account', 0, '', 1);
|
$form->select_comptes($search_account, 'search_account', 0, '', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -356,7 +414,9 @@ print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'c
|
|||||||
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
print_liste_field_titre("DateValue", $_SERVER["PHP_SELF"], "s.datev,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre("DateValue", $_SERVER["PHP_SELF"], "s.datev,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
|
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
|
||||||
if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
if (!empty($conf->banque->enabled)) {
|
||||||
|
print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
||||||
|
}
|
||||||
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
@ -371,11 +431,11 @@ print '</tr>'."\n";
|
|||||||
|
|
||||||
// Detect if we need a fetch on each output line
|
// Detect if we need a fetch on each output line
|
||||||
$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
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,10 +444,11 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
$total = 0;
|
$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);
|
||||||
@ -409,41 +470,50 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Employee
|
// Employee
|
||||||
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
|
print "<td>".$userstatic->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 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";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Account
|
// Account
|
||||||
if (!empty($conf->banque->enabled))
|
if (!empty($conf->banque->enabled)) {
|
||||||
{
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($obj->fk_bank > 0)
|
if ($obj->fk_bank > 0) {
|
||||||
{
|
|
||||||
//$accountstatic->fetch($obj->fk_bank);
|
//$accountstatic->fetch($obj->fk_bank);
|
||||||
$accountstatic->id = $obj->bid;
|
$accountstatic->id = $obj->bid;
|
||||||
$accountstatic->ref = $obj->bref;
|
$accountstatic->ref = $obj->bref;
|
||||||
$accountstatic->number = $obj->bnumber;
|
$accountstatic->number = $obj->bnumber;
|
||||||
|
|
||||||
if (!empty($conf->accounting->enabled))
|
if (!empty($conf->accounting->enabled)) {
|
||||||
{
|
|
||||||
$accountstatic->account_number = $obj->account_number;
|
$accountstatic->account_number = $obj->account_number;
|
||||||
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
$accountingjournal = new AccountingJournal($db);
|
||||||
@ -453,15 +523,23 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
|||||||
}
|
}
|
||||||
$accountstatic->label = $obj->blabel;
|
$accountstatic->label = $obj->blabel;
|
||||||
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">'.price($obj->amount).'</td>';
|
print '<td class="nowrap right">'.price($obj->amount).'</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
|
||||||
@ -472,14 +550,17 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
|||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
// Action column
|
// Action column
|
||||||
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";
|
||||||
|
|
||||||
@ -491,10 +572,13 @@ 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>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1806,7 +1806,7 @@ class User extends CommonObject
|
|||||||
|
|
||||||
$adh->pass = $this->pass;
|
$adh->pass = $this->pass;
|
||||||
|
|
||||||
$adh->societe = (empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe);
|
//$adh->societe = (empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe);
|
||||||
|
|
||||||
$adh->address = $this->address;
|
$adh->address = $this->address;
|
||||||
$adh->town = $this->town;
|
$adh->town = $this->town;
|
||||||
|
|||||||
@ -270,10 +270,10 @@ function getContact($authentication, $id, $ref_ext)
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Only internal user who have contact read permission
|
// Only internal user who have contact read permission
|
||||||
// Or for external user who have contact read permission, with restrict on societe_id
|
// Or for external user who have contact read permission, with restrict on socid
|
||||||
if (
|
if (
|
||||||
$fuser->rights->societe->contact->lire && !$fuser->societe_id
|
$fuser->rights->societe->contact->lire && !$fuser->socid
|
||||||
|| ($fuser->rights->societe->contact->lire && ($fuser->societe_id == $contact->socid))
|
|| ($fuser->rights->societe->contact->lire && ($fuser->socid == $contact->socid))
|
||||||
) {
|
) {
|
||||||
$contact_result_fields = array(
|
$contact_result_fields = array(
|
||||||
'id' => $contact->id,
|
'id' => $contact->id,
|
||||||
|
|||||||
@ -367,7 +367,7 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '')
|
|||||||
|
|
||||||
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
||||||
|
|
||||||
if ($fuser->societe_id) $socid = $fuser->societe_id;
|
if ($fuser->socid) $socid = $fuser->socid;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (!$error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext)))
|
if (!$error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext)))
|
||||||
@ -387,10 +387,10 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '')
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Security for external user
|
// Security for external user
|
||||||
if ($socid && ($socid != $order->socid))
|
if ($socid && (empty($order->socid) || $socid != $order->socid))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorcode = 'PERMISSION_DENIED'; $errorlabel = $order->socid.'User does not have permission for this request';
|
$errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
@ -516,7 +516,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty)
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
||||||
|
|
||||||
if ($fuser->societe_id) $socid = $fuser->societe_id;
|
if ($fuser->socid) $socid = $fuser->socid;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (!$error && empty($idthirdparty))
|
if (!$error && empty($idthirdparty))
|
||||||
|
|||||||
@ -208,7 +208,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '')
|
|||||||
|
|
||||||
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
||||||
|
|
||||||
if ($fuser->societe_id) $socid = $fuser->societe_id;
|
if ($fuser->socid) $socid = $fuser->socid;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (!$error && (!$file || !$modulepart))
|
if (!$error && (!$file || !$modulepart))
|
||||||
@ -234,7 +234,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '')
|
|||||||
$original_file = $check_access['original_file'];
|
$original_file = $check_access['original_file'];
|
||||||
|
|
||||||
// Basic protection (against external users only)
|
// Basic protection (against external users only)
|
||||||
if ($fuser->societe_id > 0)
|
if ($fuser->socid > 0)
|
||||||
{
|
{
|
||||||
if ($sqlprotectagainstexternals)
|
if ($sqlprotectagainstexternals)
|
||||||
{
|
{
|
||||||
@ -246,7 +246,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '')
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if ($fuser->societe_id != $obj->fk_soc)
|
if ($fuser->socid != $obj->fk_soc)
|
||||||
{
|
{
|
||||||
$accessallowed = 0;
|
$accessallowed = 0;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -157,7 +157,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($extrafield_array)) {
|
if (!empty($extrafield_array) && is_array($extrafield_array)) {
|
||||||
$productorservice_fields = array_merge($productorservice_fields, $extrafield_array);
|
$productorservice_fields = array_merge($productorservice_fields, $extrafield_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -485,7 +485,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
|
|||||||
|
|
||||||
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
||||||
|
|
||||||
if ($fuser->societe_id) $socid = $fuser->societe_id;
|
if ($fuser->socid) $socid = $fuser->socid;
|
||||||
|
|
||||||
if (!$error && !$thirdpartywithuser)
|
if (!$error && !$thirdpartywithuser)
|
||||||
{
|
{
|
||||||
@ -502,7 +502,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
|
|||||||
$thirdparty = new Societe($db);
|
$thirdparty = new Societe($db);
|
||||||
|
|
||||||
// If a contact / company already exists with the email, return the corresponding socid
|
// If a contact / company already exists with the email, return the corresponding socid
|
||||||
$sql = "SELECT s.rowid as societe_id FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql = "SELECT s.rowid as socid FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid";
|
||||||
$sql .= " WHERE s.entity=".$conf->entity;
|
$sql .= " WHERE s.entity=".$conf->entity;
|
||||||
$sql .= " AND s.email='".$db->escape($thirdpartywithuser['email'])."'";
|
$sql .= " AND s.email='".$db->escape($thirdpartywithuser['email'])."'";
|
||||||
@ -690,7 +690,7 @@ function setUserPassword($authentication, $shortuser)
|
|||||||
|
|
||||||
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
||||||
|
|
||||||
if ($fuser->societe_id) $socid = $fuser->societe_id;
|
if ($fuser->socid) $socid = $fuser->socid;
|
||||||
|
|
||||||
if (!$error && !$shortuser)
|
if (!$error && !$shortuser)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user