forked from Wavyzz/dolibarr
Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/core/class/commonobject.class.php htdocs/core/tpl/originproductline.tpl.php htdocs/fourn/facture/card.php htdocs/install/mysql/migration/14.0.0-15.0.0.sql htdocs/user/card.php
This commit is contained in:
@@ -117,7 +117,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||
}
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.amount_main_currency, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
||||
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
||||
$sql .= " soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
@@ -142,7 +142,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
|
||||
$sql .= " WHERE ba.fk_accountancy_journal=".((int) $id_journal);
|
||||
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||
$sql .= ' AND b.amount <> 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||
if ($date_start && $date_end) {
|
||||
$sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
@@ -282,6 +282,7 @@ if ($result) {
|
||||
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
||||
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
|
||||
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
|
||||
$reg = array();
|
||||
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
|
||||
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
|
||||
} else {
|
||||
@@ -296,6 +297,12 @@ if ($result) {
|
||||
$tabtype[$obj->rowid] = 'unknown';
|
||||
$tabmoreinfo[$obj->rowid] = array();
|
||||
|
||||
$amounttouse = $obj->amount;
|
||||
if (!empty($obj->amount_main_currency)) {
|
||||
// If $obj->amount_main_currency is set, it means that $obj->amount is not in same currency, we must use $obj->amount_main_currency
|
||||
$amounttouse = $obj->amount_main_currency;
|
||||
}
|
||||
|
||||
// get_url may return -1 which is not traversable
|
||||
if (is_array($links) && count($links) > 0) {
|
||||
// Now loop on each link of record in bank (code similar to bankentries_list.php)
|
||||
@@ -334,7 +341,7 @@ if ($result) {
|
||||
$societestatic->email = $tabcompany[$obj->rowid]['email'];
|
||||
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
||||
if ($compta_soc) {
|
||||
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
|
||||
}
|
||||
} elseif ($links[$key]['type'] == 'user') {
|
||||
$userstatic->id = $links[$key]['url_id'];
|
||||
@@ -350,7 +357,7 @@ if ($result) {
|
||||
$tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
|
||||
}
|
||||
if ($compta_user) {
|
||||
$tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$compta_user] += $amounttouse;
|
||||
}
|
||||
} elseif ($links[$key]['type'] == 'sc') {
|
||||
$chargestatic->id = $links[$key]['url_id'];
|
||||
@@ -383,7 +390,7 @@ if ($result) {
|
||||
$resultmid = $db->query($sqlmid);
|
||||
if ($resultmid) {
|
||||
$objmid = $db->fetch_object($resultmid);
|
||||
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$objmid->accountancy_code] += $amounttouse;
|
||||
}
|
||||
} elseif ($links[$key]['type'] == 'payment_donation') {
|
||||
$paymentdonstatic->id = $links[$key]['url_id'];
|
||||
@@ -391,7 +398,7 @@ if ($result) {
|
||||
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2);
|
||||
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
|
||||
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$account_pay_donation] += $amounttouse;
|
||||
} elseif ($links[$key]['type'] == 'member') {
|
||||
$paymentsubscriptionstatic->id = $links[$key]['url_id'];
|
||||
$paymentsubscriptionstatic->ref = $links[$key]['url_id'];
|
||||
@@ -399,14 +406,14 @@ if ($result) {
|
||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2);
|
||||
$tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id;
|
||||
$paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id);
|
||||
$tabtp[$obj->rowid][$account_pay_subscription] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$account_pay_subscription] += $amounttouse;
|
||||
} elseif ($links[$key]['type'] == 'payment_vat') { // Payment VAT
|
||||
$paymentvatstatic->id = $links[$key]['url_id'];
|
||||
$paymentvatstatic->ref = $links[$key]['url_id'];
|
||||
$paymentvatstatic->label = $links[$key]['label'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2);
|
||||
$tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id;
|
||||
$tabtp[$obj->rowid][$account_pay_vat] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$account_pay_vat] += $amounttouse;
|
||||
} elseif ($links[$key]['type'] == 'payment_salary') {
|
||||
$paymentsalstatic->id = $links[$key]['url_id'];
|
||||
$paymentsalstatic->ref = $links[$key]['url_id'];
|
||||
@@ -438,7 +445,7 @@ if ($result) {
|
||||
if (empty($obj->typeop_user)) { // Add test to avoid to add amount twice if a link already exists also on user.
|
||||
$compta_user = $userstatic->accountancy_code;
|
||||
if ($compta_user) {
|
||||
$tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$compta_user] += $amounttouse;
|
||||
$tabuser[$obj->rowid] = array(
|
||||
'id' => $userstatic->id,
|
||||
'name' => dolGetFirstLastname($userstatic->firstname, $userstatic->lastname),
|
||||
@@ -465,14 +472,14 @@ if ($result) {
|
||||
$account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
|
||||
$tabpay[$obj->rowid]["account_various"] = $account_various;
|
||||
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$account_subledger] += $amounttouse;
|
||||
} elseif ($links[$key]['type'] == 'payment_loan') {
|
||||
$paymentloanstatic->id = $links[$key]['url_id'];
|
||||
$paymentloanstatic->ref = $links[$key]['url_id'];
|
||||
$paymentloanstatic->fk_loan = $links[$key]['url_id'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2);
|
||||
$tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id;
|
||||
//$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount;
|
||||
//$tabtp[$obj->rowid][$account_pay_loan] += $amounttouse;
|
||||
$sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest';
|
||||
$sqlmid .= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
|
||||
$sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.((int) $obj->rowid);
|
||||
@@ -488,14 +495,14 @@ if ($result) {
|
||||
} elseif ($links[$key]['type'] == 'banktransfert') {
|
||||
$accountLinestatic->fetch($links[$key]['url_id']);
|
||||
$tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1);
|
||||
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$account_transfer] += $amounttouse;
|
||||
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
|
||||
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
||||
$tabbq[$obj->rowid][$compta_bank] += $amounttouse;
|
||||
|
||||
// If no links were found to know the amount on thirdparty, we try to guess it.
|
||||
// This may happens on bank entries without the links lines to 'company'.
|
||||
@@ -542,7 +549,7 @@ if ($result) {
|
||||
}
|
||||
}*/
|
||||
|
||||
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -1033,8 +1033,8 @@ if ($resql) {
|
||||
$event->type = 'holiday';
|
||||
$event->type_picto = 'holiday';
|
||||
|
||||
$event->datep = $db->jdate($obj->date_start);
|
||||
$event->datef = $db->jdate($obj->date_end);
|
||||
$event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1);
|
||||
$event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1;
|
||||
$event->date_start_in_calendar = $event->datep;
|
||||
$event->date_end_in_calendar = $event->datef;
|
||||
|
||||
|
||||
@@ -45,8 +45,14 @@ if ($mode == 'customer' && !$user->rights->commande->lire) {
|
||||
if ($mode == 'supplier' && empty($user->rights->fournisseur->commande->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($mode == 'supplier') {
|
||||
$object_status = GETPOST('object_status', 'array:int');
|
||||
$object_status = implode(',', $object_status);
|
||||
} else {
|
||||
$object_status = GETPOST('object_status', 'intcomma');
|
||||
}
|
||||
|
||||
|
||||
$object_status = GETPOST('object_status', 'intcomma');
|
||||
$typent_id = GETPOST('typent_id', 'int');
|
||||
$categ_id = GETPOST('categ_id', 'categ_id');
|
||||
|
||||
|
||||
@@ -276,6 +276,9 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
|
||||
if ($offset) {
|
||||
$param .= '&offset='.urlencode($offset);
|
||||
}
|
||||
if ($limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
if ($search_conciliated != '' && $search_conciliated != '-1') {
|
||||
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
||||
}
|
||||
|
||||
@@ -519,9 +519,10 @@ class Account extends CommonObject
|
||||
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
||||
* @param int $datev Date value
|
||||
* @param string $num_releve Label of bank receipt for reconciliation
|
||||
* @param float $amount_main_currency Amount
|
||||
* @return int Rowid of added entry, <0 if KO
|
||||
*/
|
||||
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '')
|
||||
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '', $amount_main_currency = null)
|
||||
{
|
||||
// Deprecation warning
|
||||
if (is_numeric($oper)) {
|
||||
@@ -579,6 +580,7 @@ class Account extends CommonObject
|
||||
$accline->datev = $datev;
|
||||
$accline->label = $label;
|
||||
$accline->amount = $amount;
|
||||
$accline->amount_main_currency = $amount_main_currency;
|
||||
$accline->fk_user_author = $user->id;
|
||||
$accline->fk_account = $this->id;
|
||||
$accline->fk_type = $oper;
|
||||
@@ -1801,7 +1803,8 @@ class AccountLine extends CommonObject
|
||||
*/
|
||||
public $datev;
|
||||
|
||||
public $amount;
|
||||
public $amount; /* Amount of payment in the bank account currency */
|
||||
public $amount_main_currency; /* Amount in the currency of company if bank account use another currency */
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
@@ -1962,6 +1965,7 @@ class AccountLine extends CommonObject
|
||||
$sql .= ", datev";
|
||||
$sql .= ", label";
|
||||
$sql .= ", amount";
|
||||
$sql .= ", amount_main_currency";
|
||||
$sql .= ", fk_user_author";
|
||||
$sql .= ", num_chq";
|
||||
$sql .= ", fk_account";
|
||||
@@ -1976,7 +1980,8 @@ class AccountLine extends CommonObject
|
||||
$sql .= ", '".$this->db->idate($this->datev)."'";
|
||||
$sql .= ", '".$this->db->escape($this->label)."'";
|
||||
$sql .= ", ".price2num($this->amount);
|
||||
$sql .= ", ".($this->fk_user_author > 0 ? $this->fk_user_author : "null");
|
||||
$sql .= ", ".(empty($this->amount_main_currency) ? "NULL" : price2num($this->amount_main_currency));
|
||||
$sql .= ", ".($this->fk_user_author > 0 ? ((int) $this->fk_user_author) : "null");
|
||||
$sql .= ", ".($this->num_chq ? "'".$this->db->escape($this->num_chq)."'" : "null");
|
||||
$sql .= ", '".$this->db->escape($this->fk_account)."'";
|
||||
$sql .= ", '".$this->db->escape($this->fk_type)."'";
|
||||
|
||||
@@ -811,6 +811,10 @@ class Facture extends CommonInvoice
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
|
||||
// Complete vat rate with code
|
||||
$vatrate = $newinvoiceline->tva_tx;
|
||||
if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$newinvoiceline->vat_src_code.')';
|
||||
|
||||
$newinvoiceline->fk_parent_line = $fk_parent_line;
|
||||
|
||||
if ($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except) {
|
||||
@@ -821,7 +825,37 @@ class Facture extends CommonInvoice
|
||||
$newinvoiceline->fk_remise_except = $discountId;
|
||||
}
|
||||
|
||||
$result = $newinvoiceline->insert();
|
||||
$result = $this->addline(
|
||||
$newinvoiceline->desc,
|
||||
$newinvoiceline->subprice,
|
||||
$newinvoiceline->qty,
|
||||
$vatrate,
|
||||
$newinvoiceline->localtax1_tx,
|
||||
$newinvoiceline->localtax2_tx,
|
||||
$newinvoiceline->fk_product,
|
||||
$newinvoiceline->remise_percent,
|
||||
$newinvoiceline->date_start,
|
||||
$newinvoiceline->date_end,
|
||||
$newinvoiceline->fk_code_ventilation,
|
||||
$newinvoiceline->info_bits,
|
||||
$newinvoiceline->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$newinvoiceline->product_type,
|
||||
$newinvoiceline->rang,
|
||||
$newinvoiceline->special_code,
|
||||
$newinvoiceline->element,
|
||||
$newinvoiceline->id,
|
||||
$fk_parent_line,
|
||||
$newinvoiceline->fk_fournprice,
|
||||
$newinvoiceline->pa_ht,
|
||||
$newinvoiceline->label,
|
||||
$newinvoiceline->array_options,
|
||||
$newinvoiceline->situation_percent,
|
||||
$newinvoiceline->fk_prev_id,
|
||||
$newinvoiceline->fk_unit,
|
||||
$newinvoiceline->multicurrency_subprice
|
||||
);
|
||||
|
||||
// Defined the new fk_parent_line
|
||||
if ($result > 0) {
|
||||
|
||||
@@ -266,6 +266,7 @@ if (empty($reshook)) {
|
||||
if (!$error) {
|
||||
// Create payment and update this->multicurrency_amounts if this->amounts filled or
|
||||
// this->amounts if this->multicurrency_amounts filled.
|
||||
// This also set ->amount and ->multicurrency_amount
|
||||
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty); // This include closing invoices and regenerating documents
|
||||
if ($paiement_id < 0) {
|
||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||
|
||||
@@ -636,17 +636,22 @@ class Paiement extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$totalamount = $this->amount;
|
||||
$totalamount_main_currency = null;
|
||||
if (empty($totalamount)) {
|
||||
$totalamount = $this->total; // For backward compatibility
|
||||
}
|
||||
|
||||
// if dolibarr currency != bank currency then we received an amount in customer currency (currently I don't manage the case : my currency is USD, the customer currency is EUR and he paid me in GBP. Seems no sense for me)
|
||||
if (!empty($conf->multicurrency->enabled) && $conf->currency != $acc->currency_code) {
|
||||
$totalamount = $this->multicurrency_amount;
|
||||
$totalamount = $this->multicurrency_amount; // We will insert into llx_bank.amount in foreign currency
|
||||
$totalamount_main_currency = $this->amount; // We will also save the amount in main currency into column llx_bank.amount_main_currency
|
||||
}
|
||||
|
||||
if ($mode == 'payment_supplier') {
|
||||
$totalamount = -$totalamount;
|
||||
if (isset($totalamount_main_currency)) {
|
||||
$totalamount_main_currency = -$totalamount_main_currency;
|
||||
}
|
||||
}
|
||||
|
||||
// Insert payment into llx_bank
|
||||
@@ -660,8 +665,11 @@ class Paiement extends CommonObject
|
||||
$user,
|
||||
$emetteur_nom,
|
||||
$emetteur_banque,
|
||||
$accountancycode
|
||||
);
|
||||
$accountancycode,
|
||||
null,
|
||||
'',
|
||||
$totalamount_main_currency
|
||||
);
|
||||
|
||||
// Mise a jour fk_bank dans llx_paiement
|
||||
// On connait ainsi le paiement qui a genere l'ecriture bancaire
|
||||
@@ -706,7 +714,7 @@ class Paiement extends CommonObject
|
||||
DOL_URL_ROOT.'/comm/card.php?socid=',
|
||||
$fac->thirdparty->name,
|
||||
'company'
|
||||
);
|
||||
);
|
||||
if ($result <= 0) {
|
||||
dol_syslog(get_class($this).'::addPaymentToBank '.$this->db->lasterror());
|
||||
}
|
||||
@@ -724,7 +732,7 @@ class Paiement extends CommonObject
|
||||
DOL_URL_ROOT.'/fourn/card.php?socid=',
|
||||
$fac->thirdparty->name,
|
||||
'company'
|
||||
);
|
||||
);
|
||||
if ($result <= 0) {
|
||||
dol_syslog(get_class($this).'::addPaymentToBank '.$this->db->lasterror());
|
||||
}
|
||||
@@ -742,7 +750,7 @@ class Paiement extends CommonObject
|
||||
DOL_URL_ROOT.'/compta/prelevement/card.php?id=',
|
||||
$this->num_payment,
|
||||
'withdraw'
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
// Add link 'InvoiceRefused' in bank_url
|
||||
@@ -753,7 +761,7 @@ class Paiement extends CommonObject
|
||||
DOL_URL_ROOT.'/compta/prelevement/card.php?id=',
|
||||
$this->num_prelevement,
|
||||
'withdraw'
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
@@ -1291,40 +1299,40 @@ class Paiement extends CommonObject
|
||||
|
||||
$langs->load('compta');
|
||||
/*if ($mode == 0)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate');
|
||||
if ($status == 1) return $langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate');
|
||||
if ($status == 1) return $langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
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 ($mode == 3)
|
||||
{
|
||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
|
||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
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 ($mode == 5)
|
||||
{
|
||||
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 ($mode == 6)
|
||||
{
|
||||
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 == 0) return $langs->trans('ToValidate');
|
||||
if ($status == 1) return $langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate');
|
||||
if ($status == 1) return $langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
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 ($mode == 3)
|
||||
{
|
||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
|
||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
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 ($mode == 5)
|
||||
{
|
||||
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 ($mode == 6)
|
||||
{
|
||||
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');
|
||||
}*/
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class box_birthdays extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center nowraponall"',
|
||||
'text' => dol_print_date($dateb, "day", 'gmt').' - '.$age.' '.$langs->trans('DurationYears')
|
||||
'text' => dol_print_date($dateb, "day", 'tzserver').' - '.$age.' '.$langs->trans('DurationYears')
|
||||
);
|
||||
|
||||
/*$this->info_box_contents[$line][] = array(
|
||||
|
||||
@@ -4951,18 +4951,18 @@ abstract class CommonObject
|
||||
global $langs, $hookmanager, $conf, $form, $action;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
print '<td>'.$langs->trans('Description').'</td>';
|
||||
print '<td class="right">'.$langs->trans('VATRate').'</td>';
|
||||
print '<td class="right">'.$langs->trans('PriceUHT').'</td>';
|
||||
print '<td class="linecolref">'.$langs->trans('Ref').'</td>';
|
||||
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
|
||||
print '<td class="linecolvat right">'.$langs->trans('VATRate').'</td>';
|
||||
print '<td class="linecoluht right">'.$langs->trans('PriceUHT').'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans('PriceUHTCurrency').'</td>';
|
||||
print '<td class="linecoluht_currency right">'.$langs->trans('PriceUHTCurrency').'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans('Qty').'</td>';
|
||||
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="left">'.$langs->trans('Unit').'</td>';
|
||||
print '<td class="linecoluseunit left">'.$langs->trans('Unit').'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans('ReductionShort').'</td>';
|
||||
print '<td class="linecoldiscount right">'.$langs->trans('ReductionShort').'</td>';
|
||||
print '<td class="linecolht right">'.$langs->trans('TotalHT').'</td>';
|
||||
print '<td class="center">'.$form->showCheckAddButtons('checkforselect', 1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -675,7 +675,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
$checkonentitydone = 0;
|
||||
|
||||
// Array to define rules of checks to do
|
||||
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website'); // Test on entity only (Objects with no link to company)
|
||||
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment'); // Test on entity only (Objects with no link to company)
|
||||
$checksoc = array('societe'); // Test for societe object
|
||||
$checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
|
||||
$checkproject = array('projet', 'project'); // Test for project object
|
||||
|
||||
@@ -28,20 +28,20 @@ if (empty($conf) || !is_object($conf)) {
|
||||
<!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->
|
||||
<?php
|
||||
print '<tr data-id="'.$this->tpl['id'].'" class="oddeven'.(empty($this->tpl['strike']) ? '' : ' strikefordisabled').'">';
|
||||
print '<td>'.$this->tpl['label'].'</td>';
|
||||
print '<td>'.$this->tpl['description'].'</td>';
|
||||
print '<td class="right">'.$this->tpl['vat_rate'].'</td>';
|
||||
print '<td class="right">'.$this->tpl['price'].'</td>';
|
||||
print '<td class="linecolref">'.$this->tpl['label'].'</td>';
|
||||
print '<td class="linecoldescription">'.$this->tpl['description'].'</td>';
|
||||
print '<td class="linecolvat right">'.$this->tpl['vat_rate'].'</td>';
|
||||
print '<td class="linecoluht right">'.$this->tpl['price'].'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$this->tpl['multicurrency_price'].'</td>';
|
||||
print '<td class="linecoluht_currency right">'.$this->tpl['multicurrency_price'].'</td>';
|
||||
}
|
||||
|
||||
print '<td class="right">'.$this->tpl['qty'].'</td>';
|
||||
print '<td class="linecolqty right">'.$this->tpl['qty'].'</td>';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="left">'.$langs->trans($this->tpl['unit']).'</td>';
|
||||
print '<td class="linecoluseunit left">'.$langs->trans($this->tpl['unit']).'</td>';
|
||||
}
|
||||
|
||||
print '<td class="right">'.$this->tpl['remise_percent'].'</td>';
|
||||
print '<td class="linecoldiscount right">'.$this->tpl['remise_percent'].'</td>';
|
||||
print '<td class="linecolht right">'.$this->tpl['total_ht'].'</td>';
|
||||
|
||||
$selected = 1;
|
||||
|
||||
@@ -160,11 +160,12 @@ class PaiementFourn extends Paiement
|
||||
$error = 0;
|
||||
$way = $this->getWay();
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
// Clean parameters
|
||||
$totalamount = 0;
|
||||
$totalamount_converted = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$atleastonepaymentnotnull = 0;
|
||||
|
||||
if ($way == 'dolibarr') {
|
||||
$amounts = &$this->amounts;
|
||||
@@ -174,23 +175,62 @@ class PaiementFourn extends Paiement
|
||||
$amounts_to_update = &$this->amounts;
|
||||
}
|
||||
|
||||
$currencyofpayment = '';
|
||||
|
||||
foreach ($amounts as $key => $value) {
|
||||
if (empty($value)) {
|
||||
continue;
|
||||
}
|
||||
// $key is id of invoice, $value is amount, $way is a 'dolibarr' if amount is in main currency, 'customer' if in foreign currency
|
||||
$value_converted = Multicurrency::getAmountConversionFromInvoiceRate($key, $value ? $value : 0, $way, 'facture_fourn');
|
||||
// Add controls of input validity
|
||||
if ($value_converted === false) {
|
||||
// We failed to find the conversion for one invoice
|
||||
$this->error = 'FailedToFoundTheConversionRateForInvoice';
|
||||
return -1;
|
||||
}
|
||||
if (empty($currencyofpayment)) {
|
||||
$currencyofpayment = $this->multicurrency_code[$key];
|
||||
}
|
||||
if ($currencyofpayment != $this->multicurrency_code[$key]) {
|
||||
// If we have invoices with different currencies in the payment, we stop here
|
||||
$this->error = 'ErrorYouTryToPayInvoicesWithDifferentCurrenciesInSamePayment';
|
||||
return -1;
|
||||
}
|
||||
|
||||
$totalamount_converted += $value_converted;
|
||||
$amounts_to_update[$key] = price2num($value_converted, 'MT');
|
||||
|
||||
$newvalue = price2num($value, 'MT');
|
||||
$amounts[$key] = $newvalue;
|
||||
$totalamount += $newvalue;
|
||||
if (!empty($newvalue)) {
|
||||
$atleastonepaymentnotnull++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($currencyofpayment)) {
|
||||
// We must check that the currency of invoices is the same than the currency of the bank
|
||||
$bankaccount = new Account($this->db);
|
||||
$bankaccount->fetch($this->fk_account);
|
||||
$bankcurrencycode = empty($bankaccount->currency_code) ? $conf->currency : $bankaccount->currency_code;
|
||||
if ($currencyofpayment != $bankcurrencycode && $currencyofpayment != $conf->currency && $bankcurrencycode != $conf->currency) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorYouTryToPayInvoicesInACurrencyFromBankWithAnotherCurrency', $currencyofpayment, $bankcurrencycode);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$totalamount = price2num($totalamount);
|
||||
$totalamount_converted = price2num($totalamount_converted);
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($totalamount <> 0) { // On accepte les montants negatifs
|
||||
$ref = $this->getNextNumRef(is_object($thirdparty) ? $thirdparty : '');
|
||||
$now = dol_now();
|
||||
|
||||
if ($way == 'dolibarr') {
|
||||
$total = $totalamount;
|
||||
@@ -346,7 +386,7 @@ class PaiementFourn extends Paiement
|
||||
$this->total = $total;
|
||||
$this->multicurrency_amount = $mtotal;
|
||||
$this->db->commit();
|
||||
dol_syslog('PaiementFourn::Create Ok Total = '.$this->total);
|
||||
dol_syslog('PaiementFourn::Create Ok Total = '.$this->amount.', Total currency = '.$this->multicurrency_amount);
|
||||
return $this->id;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
|
||||
@@ -3192,7 +3192,7 @@ if ($action == 'create') {
|
||||
}
|
||||
// Show link for "recalculate"
|
||||
if ($object->getVentilExportCompta() == 0) {
|
||||
$s = '<span class="hideonsmartphone">'.$langs->trans("ReCalculate").' </span>';
|
||||
$s = '<span class="hideonsmartphone opacitymedium">'.$langs->trans("ReCalculate").' </span>';
|
||||
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>';
|
||||
$s .= ' / ';
|
||||
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>';
|
||||
|
||||
@@ -268,6 +268,8 @@ if (empty($reshook)) {
|
||||
|
||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
$multicurrency_code = array();
|
||||
|
||||
// Clean parameters amount if payment is for a credit note
|
||||
foreach ($amounts as $key => $value) { // How payment is dispatched
|
||||
$tmpinvoice = new FactureFournisseur($db);
|
||||
@@ -276,6 +278,7 @@ if (empty($reshook)) {
|
||||
$newvalue = price2num($value, 'MT');
|
||||
$amounts[$key] = - abs($newvalue);
|
||||
}
|
||||
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
|
||||
}
|
||||
|
||||
foreach ($multicurrency_amounts as $key => $value) { // How payment is dispatched
|
||||
@@ -285,6 +288,7 @@ if (empty($reshook)) {
|
||||
$newvalue = price2num($value, 'MT');
|
||||
$multicurrency_amounts[$key] = - abs($newvalue);
|
||||
}
|
||||
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
|
||||
}
|
||||
|
||||
//var_dump($amounts);
|
||||
@@ -304,12 +308,16 @@ if (empty($reshook)) {
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amounts = $amounts; // Array of amounts
|
||||
$paiement->multicurrency_amounts = $multicurrency_amounts;
|
||||
$paiement->multicurrency_code = $multicurrency_code; // Array with all currency of payments dispatching
|
||||
$paiement->paiementid = GETPOST('paiementid', 'int');
|
||||
|
||||
$paiement->num_payment = GETPOST('num_paiement', 'alphanohtml');
|
||||
$paiement->note_private = GETPOST('comment', 'alpha');
|
||||
$paiement->fk_account = GETPOST('accountid', 'int');
|
||||
|
||||
if (!$error) {
|
||||
// Create payment and update this->multicurrency_amounts if this->amounts filled or
|
||||
// this->amounts if this->multicurrency_amounts filled.
|
||||
// This also set ->amount and ->multicurrency_amount
|
||||
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty);
|
||||
if ($paiement_id < 0) {
|
||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||
@@ -318,7 +326,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$result = $paiement->addPaymentToBank($user, 'payment_supplier', '(SupplierInvoicePayment)', $accountid, '', '');
|
||||
$result = $paiement->addPaymentToBank($user, 'payment_supplier', '(SupplierInvoicePayment)', $accountid, GETPOST('chqemetteur'), GETPOST('chqbank'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||
$error++;
|
||||
|
||||
@@ -471,10 +471,9 @@ if (empty($reshook)) {
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysToValidate");
|
||||
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message .= "\n";
|
||||
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysToValidateBody")."\n";
|
||||
$message .= "<p>".$langs->transnoentities("HolidaysToValidateBody")."</p>\n";
|
||||
|
||||
|
||||
// option to warn the validator in case of too short delay
|
||||
@@ -484,8 +483,7 @@ if (empty($reshook)) {
|
||||
$nowplusdelay = dol_time_plus_duree($now, $delayForRequest, 'd');
|
||||
|
||||
if ($object->date_debut < $nowplusdelay) {
|
||||
$message .= "\n";
|
||||
$message .= $langs->transnoentities("HolidaysToValidateDelay", $delayForRequest)."\n";
|
||||
$message = "<p>".$langs->transnoentities("HolidaysToValidateDelay", $delayForRequest)."</p>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -495,20 +493,21 @@ if (empty($reshook)) {
|
||||
$nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
|
||||
|
||||
if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) {
|
||||
$message .= "\n";
|
||||
$message .= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n";
|
||||
$message .= "<p>".$langs->transnoentities("HolidaysToValidateAlertSolde")."</p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$message .= "\n";
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')."\n";
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
|
||||
$message .= "\n";
|
||||
$link = dol_buildpath("/holiday/card.php", 3) . '?id='.$object->id;
|
||||
|
||||
$message .= "<ul>";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')."</li>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
|
||||
$message .= "</ul>\n";
|
||||
|
||||
$trackid = 'leav'.$object->id;
|
||||
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
|
||||
|
||||
// Sending the email
|
||||
$result = $mail->sendfile();
|
||||
@@ -617,19 +616,20 @@ if (empty($reshook)) {
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated");
|
||||
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message .= "\n";
|
||||
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n";
|
||||
$message .= "<p>".$langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."</p>\n";
|
||||
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id;
|
||||
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
|
||||
$message .= "\n";
|
||||
$message .= "<ul>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
|
||||
$message .= "</ul>\n";
|
||||
|
||||
$trackid = 'leav'.$object->id;
|
||||
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
|
||||
|
||||
// Sending email
|
||||
$result = $mail->sendfile();
|
||||
@@ -697,20 +697,21 @@ if (empty($reshook)) {
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysRefused");
|
||||
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message .= "\n";
|
||||
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n";
|
||||
$message .= GETPOST('detail_refuse', 'alpha')."\n\n";
|
||||
$message .= "<p>".$langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."<p>\n";
|
||||
$message .= "<p>".GETPOST('detail_refuse', 'alpha')."</p>";
|
||||
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id;
|
||||
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
|
||||
$message .= "\n";
|
||||
$message .= "<ul>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
|
||||
$message .= "</ul>";
|
||||
|
||||
$trackid = 'leav'.$object->id;
|
||||
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
|
||||
|
||||
// sending email
|
||||
$result = $mail->sendfile();
|
||||
@@ -842,18 +843,20 @@ if (empty($reshook)) {
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysCanceled");
|
||||
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message .= "\n";
|
||||
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n";
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$message .= "<p>".$langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."</p>\n";
|
||||
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
|
||||
$message .= "\n";
|
||||
$link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id;
|
||||
|
||||
$message .= "<ul>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
|
||||
$message .= "</ul>\n";
|
||||
|
||||
$trackid = 'leav'.$object->id;
|
||||
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
|
||||
|
||||
// sending email
|
||||
$result = $mail->sendfile();
|
||||
|
||||
@@ -537,3 +537,7 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154,
|
||||
-- VMYSQL4.3 ALTER TABLE llx_user MODIFY COLUMN fk_soc integer NULL;
|
||||
-- VPGSQL8.2 ALTER TABLE llx_user ALTER COLUMN fk_soc DROP NOT NULL;
|
||||
|
||||
-- Add column to help to fix a very critical bug when transferring into accounting bank record of a bank account into another currency.
|
||||
-- Idea is to update this column manually in v15 with value in currency of company for bank that are not into the main currency and the transfer
|
||||
-- into accounting will use it in priority if value is not null.
|
||||
ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL;
|
||||
|
||||
@@ -557,3 +557,8 @@ UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NUL
|
||||
|
||||
DELETE FROM llx_rights_def WHERE module = 'hrm' AND perms = 'employee';
|
||||
|
||||
|
||||
-- Sequence to fix the content of llx_bank.amount_main_currency
|
||||
-- DROP TABLE tmp_bank;
|
||||
-- CREATE TABLE tmp_bank SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment' INNER JOIN llx_paiement as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount;
|
||||
-- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL;
|
||||
|
||||
@@ -24,7 +24,8 @@ create table llx_bank
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
datev date, -- date de valeur
|
||||
dateo date, -- date operation
|
||||
amount double(24,8) NOT NULL default 0,
|
||||
amount double(24,8) NOT NULL default 0, -- amount in the currency of the bank account
|
||||
amount_main_currency double(24,8) NULL, -- amount in the main currency of the company
|
||||
label varchar(255),
|
||||
fk_account integer,
|
||||
fk_user_author integer,
|
||||
|
||||
@@ -272,6 +272,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if (!empty($sortfield)) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
|
||||
}
|
||||
|
||||
@@ -198,6 +198,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if (!empty($sortfield)) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if (!empty($sortfield)) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER ['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if (!empty($sortfield)) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if (!empty($sortfield)) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
|
||||
}
|
||||
|
||||
@@ -176,6 +176,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if (!empty($sortfield)) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
|
||||
}
|
||||
|
||||
@@ -199,6 +199,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if (!empty($sortfield)) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
|
||||
}
|
||||
|
||||
@@ -198,6 +198,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if (!empty($sortfield)) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
|
||||
}
|
||||
|
||||
@@ -909,10 +909,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
}
|
||||
|
||||
// Desired stock
|
||||
print '<td class="right">'.($fk_entrepot > 0 ? $desiredstockwarehouse : $desiredstock).'</td>';
|
||||
print '<td class="right">'.((!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) > 0 ? $desiredstockwarehouse : $desiredstock).'</td>';
|
||||
|
||||
// Limit stock for alert
|
||||
print '<td class="right">'.($fk_entrepot > 0 ? $alertstockwarehouse : $alertstock).'</td>';
|
||||
print '<td class="right">'.((!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) > 0 ? $alertstockwarehouse : $alertstock).'</td>';
|
||||
|
||||
// Current stock (all warehouses)
|
||||
print '<td class="right">'.$warning.$stock;
|
||||
@@ -928,7 +928,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
print '<td class="right"><a href="replenishorders.php?search_product='.$prod->id.'">'.$ordered.'</a> '.$picto.'</td>';
|
||||
|
||||
// To order
|
||||
print '<td class="right"><input type="text" size="4" name="tobuy'.$i.'" value="'.($fk_entrepot > 0 ? $stocktobuywarehouse : $stocktobuy).'"></td>';
|
||||
print '<td class="right"><input type="text" size="4" name="tobuy'.$i.'" value="'.((!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) > 0 ? $stocktobuywarehouse : $stocktobuy).'"></td>';
|
||||
|
||||
// Supplier
|
||||
print '<td class="right">';
|
||||
|
||||
@@ -1277,7 +1277,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
// Date birth
|
||||
print '<tr><td>'.$langs->trans("DateOfBirth").'</td>';
|
||||
print '<td>';
|
||||
print $form->selectDate($dateofbirth, 'dateofbirth', 0, 0, 1, 'createuser', 1, 0);
|
||||
print $form->selectDate($dateofbirth, 'dateofbirth', 0, 0, 1, 'createuser', 1, 0, 0, '', 0, '', '', 1, '', '', 'tzserver');
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -1568,6 +1568,13 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Date of birth
|
||||
print '<tr><td>'.$langs->trans("DateOfBirth").'</td>';
|
||||
print '<td>';
|
||||
print dol_print_date($object->birth, 'day', 'tzserver');
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Default warehouse
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
@@ -1846,7 +1853,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', '', $canSendMail, $params);
|
||||
}
|
||||
|
||||
if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => '',
|
||||
@@ -1860,7 +1867,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken(), '', true, $params);
|
||||
}
|
||||
} elseif ($caneditpassword && !$object->ldap_sid &&
|
||||
(empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
(empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => '',
|
||||
@@ -1882,7 +1889,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
$params['attr']['title'] = $langs->trans('UserDisabled');
|
||||
print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
|
||||
} elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=password&token='.newToken(), '', true, $params);
|
||||
}
|
||||
|
||||
@@ -1890,7 +1897,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
$params['attr']['title'] = $langs->trans('UserDisabled');
|
||||
print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
|
||||
} elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
if ($object->email) {
|
||||
print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=passwordsend&token='.newToken(), '', true, $params);
|
||||
} else {
|
||||
@@ -1908,12 +1915,12 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
)
|
||||
);
|
||||
if ($user->id <> $id && $candisableuser && $object->statut == 0 &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=enable&token='.newToken(), '', true, $params);
|
||||
}
|
||||
// Disable user
|
||||
if ($user->id <> $id && $candisableuser && $object->statut == 1 &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=disable&token='.newToken(), '', true, $params);
|
||||
} else {
|
||||
if ($user->id == $id) {
|
||||
@@ -1923,7 +1930,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
}
|
||||
// Delete
|
||||
if ($user->id <> $id && $candisableuser &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
if ($user->admin || !$object->admin) { // If user edited is admin, delete is possible on for an admin
|
||||
print dolGetButtonAction($langs->trans('DeleteUser'), '', 'default', $_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id, '', true, $params);
|
||||
} else {
|
||||
@@ -2759,9 +2766,9 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print '<tr><td>'.$langs->trans("DateOfBirth").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield) {
|
||||
echo $form->selectDate($dateofbirth ? $dateofbirth : $object->birth, 'dateofbirth', 0, 0, 1, 'updateuser', 1, 0);
|
||||
echo $form->selectDate($dateofbirth ? $dateofbirth : $object->birth, 'dateofbirth', 0, 0, 1, 'updateuser', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
|
||||
} else {
|
||||
print dol_print_date($object->birth, 'day');
|
||||
print dol_print_date($object->birth, 'day', 'tzserver');
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -1873,7 +1873,7 @@ class User extends CommonObject
|
||||
$sql .= ", login = '".$this->db->escape($this->login)."'";
|
||||
$sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null");
|
||||
$sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
|
||||
$sql .= ", birth=".(strval($this->birth) != '' ? "'".$this->db->idate($this->birth)."'" : 'null');
|
||||
$sql .= ", birth=".(strval($this->birth) != '' ? "'".$this->db->idate($this->birth, 'tzserver')."'" : 'null');
|
||||
if (!empty($user->admin)) {
|
||||
$sql .= ", admin = ".(int) $this->admin; // admin flag can be set/unset only by an admin user
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user