Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
This commit is contained in:
commit
9c78304bfb
16 changed files with 150 additions and 80 deletions
|
|
@ -4788,6 +4788,7 @@ if ($action == 'create') {
|
|||
|
||||
print '<!-- amounts -->'."\n";
|
||||
print '<div class="underbanner clearboth"></div>'."\n";
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
$sign = 1;
|
||||
|
|
@ -4795,44 +4796,61 @@ if ($action == 'create') {
|
|||
$sign = -1; // We invert sign for output
|
||||
}
|
||||
|
||||
if (isModEnabled('multicurrency') && ($object->multicurrency_code != $conf->currency)) {
|
||||
print '<tr>';
|
||||
// Amount HT
|
||||
print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
|
||||
// Vat
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td colspan="3" class="nowrap right amountcard">'.price($sign * $object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
print '<tr>';
|
||||
// Amount VAT
|
||||
print '<td class="titlefieldmiddle">' . $langs->trans('AmountVAT') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount VAT
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) { // Localtax1
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
}
|
||||
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { // Localtax2
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) {
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) {
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Revenue stamp
|
||||
if ($selleruserevenustamp) { // Test company use revenue stamp
|
||||
print '<tr><td>';
|
||||
print '<tr>';
|
||||
// Amount TTC
|
||||
print '<td>' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount TTC
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Ajouter la première condition
|
||||
if ($selleruserevenustamp) {
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('RevenueStamp');
|
||||
print '</td>';
|
||||
|
|
@ -4852,43 +4870,37 @@ if ($action == 'create') {
|
|||
print ' <input type="submit" class="button buttongen button-save" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
print " <script>
|
||||
$(document).ready(function(){
|
||||
js_recalculate_revenuestamp();
|
||||
$('select[name=revenuestamp_type]').on('change',function(){
|
||||
js_recalculate_revenuestamp();
|
||||
});
|
||||
});
|
||||
function js_recalculate_revenuestamp(){
|
||||
var valselected = $('select[name=revenuestamp_type]').val();
|
||||
console.log('Calculate revenue stamp from '+valselected);
|
||||
var revenue = 0;
|
||||
if (valselected.indexOf('%') == -1)
|
||||
{
|
||||
revenue = valselected;
|
||||
}
|
||||
else
|
||||
{
|
||||
$(document).ready(function(){
|
||||
js_recalculate_revenuestamp();
|
||||
$('select[name=revenuestamp_type]').on('change',function(){
|
||||
js_recalculate_revenuestamp();
|
||||
});
|
||||
});
|
||||
function js_recalculate_revenuestamp(){
|
||||
var valselected = $('select[name=revenuestamp_type]').val();
|
||||
console.log('Calculate revenue stamp from '+valselected);
|
||||
var revenue = 0;
|
||||
if (valselected.indexOf('%') == -1)
|
||||
{
|
||||
revenue = valselected;
|
||||
}
|
||||
else
|
||||
{
|
||||
var revenue_type = parseFloat(valselected);
|
||||
var amount_net = ".round($object->total_ht, 2).";
|
||||
revenue = revenue_type * amount_net / 100;
|
||||
revenue = revenue.toFixed(2);
|
||||
}
|
||||
$('#revenuestamp_val').val(revenue);
|
||||
$('#revenuestamp_span').html(revenue);
|
||||
}
|
||||
</script>";
|
||||
}
|
||||
$('#revenuestamp_val').val(revenue);
|
||||
$('#revenuestamp_span').html(revenue);
|
||||
}
|
||||
</script>";
|
||||
} else {
|
||||
print price($object->revenuestamp, 1, '', 1, - 1, - 1, $conf->currency);
|
||||
print price($object->revenuestamp, 1, '', 1, -1, -1, $conf->currency);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Total with tax
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="nowrap right amountcard">'.price($sign * $object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
$nbrows = 8;
|
||||
$nbcols = 3;
|
||||
if (isModEnabled('project')) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2023 Sylvain Legrand <technique@infras.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -223,6 +224,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
$multicurrency_code = array();
|
||||
$multicurrency_tx = array();
|
||||
|
||||
// Clean parameters amount if payment is for a credit note
|
||||
foreach ($amounts as $key => $value) { // How payment is dispatched
|
||||
|
|
@ -233,6 +235,7 @@ if (empty($reshook)) {
|
|||
$amounts[$key] = - abs($newvalue);
|
||||
}
|
||||
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
|
||||
$multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
|
||||
}
|
||||
|
||||
foreach ($multicurrency_amounts as $key => $value) { // How payment is dispatched
|
||||
|
|
@ -243,6 +246,7 @@ if (empty($reshook)) {
|
|||
$multicurrency_amounts[$key] = - abs($newvalue);
|
||||
}
|
||||
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
|
||||
$multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
|
||||
}
|
||||
|
||||
if (isModEnabled("banque")) {
|
||||
|
|
@ -259,6 +263,7 @@ if (empty($reshook)) {
|
|||
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
||||
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
||||
$paiement->multicurrency_code = $multicurrency_code; // Array with all currency of payments dispatching
|
||||
$paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching
|
||||
$paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1);
|
||||
$paiement->num_payment = GETPOST('num_paiement', 'alpha');
|
||||
$paiement->note_private = GETPOST('comment', 'alpha');
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
* Copyright (C) 2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
|
||||
* Copyright (C) 2021 OpenDsi <support@open-dsi.fr>
|
||||
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
|
||||
* Copyright (C) 2023 Sylvain Legrand <technique@infras.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -76,6 +77,7 @@ class Paiement extends CommonObject
|
|||
public $multicurrency_amount; // Total amount of payment (in the currency of the bank account)
|
||||
public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)
|
||||
public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)
|
||||
public $multicurrency_tx = array(); // array: invoice ID => currency tx for that invoice
|
||||
public $multicurrency_code = array(); // array: invoice ID => currency code for that invoice
|
||||
|
||||
public $pos_change = 0; // Excess received in TakePOS cash payment
|
||||
|
|
@ -262,6 +264,7 @@ class Paiement extends CommonObject
|
|||
}
|
||||
|
||||
$currencyofpayment = '';
|
||||
$currencytxofpayment = '';
|
||||
|
||||
foreach ($amounts as $key => $value) { // How payment is dispatch
|
||||
if (empty($value)) {
|
||||
|
|
@ -282,6 +285,9 @@ class Paiement extends CommonObject
|
|||
$this->error = 'ErrorYouTryToPayInvoicesWithDifferentCurrenciesInSamePayment';
|
||||
return -1;
|
||||
}
|
||||
if (empty($currencytxofpayment)) {
|
||||
$currencytxofpayment = isset($this->multicurrency_tx[$key]) ? $this->multicurrency_tx[$key] : "";
|
||||
}
|
||||
|
||||
$totalamount_converted += $value_converted;
|
||||
$amounts_to_update[$key] = price2num($value_converted, 'MT');
|
||||
|
|
@ -351,9 +357,8 @@ class Paiement extends CommonObject
|
|||
$facid = $key;
|
||||
if (is_numeric($amount) && $amount <> 0) {
|
||||
$amount = price2num($amount);
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement_facture (fk_facture, fk_paiement, amount, multicurrency_amount)";
|
||||
// TODO Add multicurrency_code and multicurrency_tx
|
||||
$sql .= " VALUES (".((int) $facid).", ".((int) $this->id).", ".((float) $amount).", ".((float) $this->multicurrency_amounts[$key]).")";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement_facture (fk_facture, fk_paiement, amount, multicurrency_amount, multicurrency_code, multicurrency_tx)";
|
||||
$sql .= " VALUES (".((int) $facid).", ".((int) $this->id).", ".((float) $amount).", ".((float) $this->multicurrency_amounts[$key]).", ".($this->multicurrency_code ? $this->db->escape($currencyofpayment) : 'NULL').", ".(!empty($this->multicurrency_tx) ? (double) $currencytxofpayment : 1).")";
|
||||
|
||||
dol_syslog(get_class($this).'::create Amount line '.$key.' insert paiement_facture', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
|
|||
|
|
@ -1537,7 +1537,7 @@ class Contact extends CommonObject
|
|||
$linkend = '</a>';
|
||||
}
|
||||
|
||||
$result .= $linkstart;
|
||||
$result .= (($option == 'nolink') ? '' : $linkstart);
|
||||
if ($withpicto) {
|
||||
if ($withpicto < 0) {
|
||||
$result .= '<!-- picto photo user --><span class="nopadding userimg'.($morecss ? ' '.$morecss : '').'">'.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).'</span>';
|
||||
|
|
@ -1548,7 +1548,7 @@ class Contact extends CommonObject
|
|||
if ($withpicto != 2 && $withpicto != -2) {
|
||||
$result .= '<span class="valigmiddle">'.($maxlen ? dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs)).'</span>';
|
||||
}
|
||||
$result .= $linkend;
|
||||
$result .= (($option == 'nolink') ? '' : $linkend);
|
||||
|
||||
global $action;
|
||||
$hookmanager->initHooks(array('contactdao'));
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class box_members_by_tags extends ModeleBoxes
|
|||
);
|
||||
$line++;
|
||||
foreach ($sumMembers as $key => $data) {
|
||||
$adhtag = new Categorie($db);
|
||||
$adhtag = new Categorie($this->db);
|
||||
$adhtag->id = $key;
|
||||
|
||||
if ($key=='total') {
|
||||
|
|
|
|||
|
|
@ -2306,6 +2306,11 @@ class ExtraFields
|
|||
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
$value_key = $value_arr;
|
||||
}
|
||||
} elseif (in_array($key_type, array('html'))) {
|
||||
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
|
||||
continue; // Value was not provided, we should not set it.
|
||||
}
|
||||
$value_key = dol_htmlcleanlastbr(GETPOST($keysuffix."options_".$key.$keyprefix, 'restricthtml'));
|
||||
} else {
|
||||
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
|
||||
continue; // Value was not provided, we should not set it.
|
||||
|
|
|
|||
|
|
@ -7770,7 +7770,7 @@ class Form
|
|||
|
||||
if (!$forcecombo) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);
|
||||
$out .= ajax_combobox($htmlname, $events, !empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT) ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
|
||||
}
|
||||
|
||||
$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2022 Thibault Foucart <support@ptibogxiv.net>
|
||||
* Copyright (C) 2019-2023 Thibault Foucart <support@ptibogxiv.net>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
|
|
@ -7721,7 +7721,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
|
||||
'__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'),
|
||||
'__USER_JOB__' => (string) $user->job,
|
||||
'__USER_REMOTE_IP__' => (string) getUserRemoteIP()
|
||||
'__USER_REMOTE_IP__' => (string) getUserRemoteIP(),
|
||||
'__USER_VCARD_URL__' => (string) $user->getOnlineVirtualCardUrl('', 'external')
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -12127,6 +12128,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||
$sql .= " a.percent as percent, 'action' as type,";
|
||||
$sql .= " a.fk_element, a.elementtype,";
|
||||
$sql .= " a.fk_contact,";
|
||||
$sql .= " a.email_from as msg_from,";
|
||||
$sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
|
||||
$sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
|
||||
|
|
@ -12326,6 +12328,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||
'userfirstname'=>$obj->user_firstname,
|
||||
'userlastname'=>$obj->user_lastname,
|
||||
'userphoto'=>$obj->user_photo,
|
||||
'msg_from'=>$obj->msg_from,
|
||||
|
||||
'contact_id'=>$obj->fk_contact,
|
||||
'socpeopleassigned' => $contactaction->socpeopleassigned,
|
||||
|
|
@ -12389,6 +12392,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||
$userstatic = new User($db);
|
||||
$contactstatic = new Contact($db);
|
||||
$userGetNomUrlCache = array();
|
||||
$contactGetNomUrlCache = array();
|
||||
|
||||
$out .= '<div class="filters-container" >';
|
||||
$out .= '<form name="listactionsfilter" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
|
@ -12550,6 +12554,15 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||
$userGetNomUrlCache[$histo[$key]['userid']] = $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, 'firstelselast', '');
|
||||
}
|
||||
$out .= $userGetNomUrlCache[$histo[$key]['userid']];
|
||||
} elseif (!empty($histo[$key]['msg_from']) && $actionstatic->code == 'TICKET_MSG') {
|
||||
if (!isset($contactGetNomUrlCache[$histo[$key]['msg_from']])) {
|
||||
if ($contactstatic->fetch(0, null, '', $histo[$key]['msg_from']) > 0) {
|
||||
$contactGetNomUrlCache[$histo[$key]['msg_from']] = $contactstatic->getNomUrl(-1, '', 16);
|
||||
} else {
|
||||
$contactGetNomUrlCache[$histo[$key]['msg_from']] = $histo[$key]['msg_from'];
|
||||
}
|
||||
}
|
||||
$out .= $contactGetNomUrlCache[$histo[$key]['msg_from']];
|
||||
}
|
||||
$out .= '</div>';
|
||||
|
||||
|
|
|
|||
|
|
@ -336,8 +336,10 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
|||
$object->fetchObjectLinked('', '', '', '');
|
||||
//print_r($object->linkedObjects['propal']); exit;
|
||||
|
||||
if (isset($object->linkedObjects['propal'][0])) {
|
||||
$propal_object = $object->linkedObjects['propal'][0];
|
||||
$array_propal_object = $object->linkedObjects['propal'];
|
||||
if (isset($array_propal_object) && is_array($array_propal_object) && count($array_propal_object) > 0) {
|
||||
$tmparrayofvalue = array_values($array_propal_object);
|
||||
$propal_object = $tmparrayofvalue[0];
|
||||
} else {
|
||||
$propal_object = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.francenetlogic.fr>
|
||||
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
|
||||
* Copyright (C) 2023 Sylvain Legrand <technique@infras.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -186,6 +187,7 @@ class PaiementFourn extends Paiement
|
|||
}
|
||||
|
||||
$currencyofpayment = '';
|
||||
$currencytxofpayment = '';
|
||||
|
||||
foreach ($amounts as $key => $value) {
|
||||
if (empty($value)) {
|
||||
|
|
@ -207,6 +209,9 @@ class PaiementFourn extends Paiement
|
|||
$this->error = 'ErrorYouTryToPayInvoicesWithDifferentCurrenciesInSamePayment';
|
||||
return -1;
|
||||
}
|
||||
if (empty($currencytxofpayment)) {
|
||||
$currencytxofpayment = $this->multicurrency_tx[$key];
|
||||
}
|
||||
|
||||
$totalamount_converted += $value_converted;
|
||||
$amounts_to_update[$key] = price2num($value_converted, 'MT');
|
||||
|
|
@ -264,8 +269,8 @@ class PaiementFourn extends Paiement
|
|||
$facid = $key;
|
||||
if (is_numeric($amount) && $amount <> 0) {
|
||||
$amount = price2num($amount);
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn_facturefourn (fk_facturefourn, fk_paiementfourn, amount, multicurrency_amount)';
|
||||
$sql .= " VALUES (".((int) $facid).", ".((int) $this->id).", ".((float) $amount).', '.((float) $this->multicurrency_amounts[$key]).')';
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn_facturefourn (fk_facturefourn, fk_paiementfourn, amount, multicurrency_amount, multicurrency_code, multicurrency_tx)';
|
||||
$sql .= " VALUES (".((int) $facid).", ".((int) $this->id).", ".((float) $amount).', '.((float) $this->multicurrency_amounts[$key]).', '.($currencyofpayment ? '"'.$this->db->escape($currencyofpayment).'"' : 'NULL').', '.(!empty($currencytxofpayment) ? (double) $currencytxofpayment : 1).')';
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$invoice = new FactureFournisseur($this->db);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2022 Udo Tamm <dev@dolibit.de>
|
||||
* Copyright (C) 2023 Sylvain Legrand <technique@infras.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -270,6 +271,7 @@ if (empty($reshook)) {
|
|||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
$multicurrency_code = array();
|
||||
$multicurrency_tx = array();
|
||||
|
||||
// Clean parameters amount if payment is for a credit note
|
||||
foreach ($amounts as $key => $value) { // How payment is dispatched
|
||||
|
|
@ -280,6 +282,7 @@ if (empty($reshook)) {
|
|||
$amounts[$key] = - abs($newvalue);
|
||||
}
|
||||
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
|
||||
$multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
|
||||
}
|
||||
|
||||
foreach ($multicurrency_amounts as $key => $value) { // How payment is dispatched
|
||||
|
|
@ -290,6 +293,7 @@ if (empty($reshook)) {
|
|||
$multicurrency_amounts[$key] = - abs($newvalue);
|
||||
}
|
||||
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
|
||||
$multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
|
||||
}
|
||||
|
||||
//var_dump($amounts);
|
||||
|
|
@ -310,6 +314,7 @@ if (empty($reshook)) {
|
|||
$paiement->amounts = $amounts; // Array of amounts
|
||||
$paiement->multicurrency_amounts = $multicurrency_amounts;
|
||||
$paiement->multicurrency_code = $multicurrency_code; // Array with all currency of payments dispatching
|
||||
$paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching
|
||||
$paiement->paiementid = GETPOST('paiementid', 'int');
|
||||
$paiement->num_payment = GETPOST('num_paiement', 'alphanohtml');
|
||||
$paiement->note_private = GETPOST('comment', 'alpha');
|
||||
|
|
|
|||
|
|
@ -1089,7 +1089,11 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
|
|||
<div id="ModalTerminal" class="modal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<span class="close" href="#" onclick="document.getElementById('ModalTerminal').style.display = 'none';">×</span>
|
||||
<?php
|
||||
if (empty($conf->global->TAKEPOS_FORCE_TERMINAL_SELECT)) {
|
||||
?>
|
||||
<span class="close" href="#" onclick="document.getElementById('ModalTerminal').style.display = 'none';">×</span>
|
||||
<?php } ?>
|
||||
<h3><?php print $langs->trans("TerminalSelect"); ?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
|
|
|||
|
|
@ -598,7 +598,7 @@ if (empty($reshook)) {
|
|||
$localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
|
||||
|
||||
$invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', 0, 0, 0, '', getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') ? 'HT' : 'TTC', $number, 0, -1, 0, '', 0, 0, null, '', '', 0, 100, '', null, 0);
|
||||
$invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', 0, 0, 0, '', getDolGlobalInt('TAKEPOS_DISCOUNT_TTC') ? ($number >= 0 ? 'HT' : 'TTC') : (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') ? 'HT' : 'TTC'), $number, 0, -1, 0, '', 0, 0, null, '', '', 0, 100, '', null, 0);
|
||||
$invoice->fetch($placeid);
|
||||
}
|
||||
|
||||
|
|
@ -1684,7 +1684,7 @@ if ($placeid > 0) {
|
|||
|
||||
print '</table>';
|
||||
|
||||
if (($action == "valid" || $action == "history") && $invoice->type != Facture::TYPE_CREDIT_NOTE) {
|
||||
if (($action == "valid" || $action == "history") && $invoice->type != Facture::TYPE_CREDIT_NOTE && empty($conf->global->TAKEPOS_NO_CREDITNOTE)) {
|
||||
print '<button id="buttonprint" type="button" onclick="ModalBox(\'ModalCreditNote\')">'.$langs->trans('CreateCreditNote').'</button>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -306,6 +306,14 @@ class ActionsTicket
|
|||
if ($res) {
|
||||
print $userstat->getNomUrl(0);
|
||||
}
|
||||
} elseif (isset($arraymsgs['fk_contact_author'])) {
|
||||
$contactstat = new Contact($this->db);
|
||||
$res = $contactstat->fetch(0, null, '', $arraymsgs['fk_contact_author']);
|
||||
if ($res) {
|
||||
print $contactstat->getNomUrl(0, 'nolink');
|
||||
} else {
|
||||
print $arraymsgs['fk_contact_author'];
|
||||
}
|
||||
} else {
|
||||
print $langs->trans('Customer');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1706,6 +1706,9 @@ class Ticket extends CommonObject
|
|||
if ($send_email) {
|
||||
$actioncomm->code .= '_SENTBYMAIL';
|
||||
}
|
||||
if ((empty($user->id) || $user->id == 0) && isset($_SESSION['email_customer'])) {
|
||||
$actioncomm->email_from = $_SESSION['email_customer'];
|
||||
}
|
||||
$actioncomm->socid = $this->socid;
|
||||
$actioncomm->label = $this->subject;
|
||||
$actioncomm->note_private = $this->message;
|
||||
|
|
@ -1759,7 +1762,7 @@ class Ticket extends CommonObject
|
|||
|
||||
// Cache already loaded
|
||||
|
||||
$sql = "SELECT id as rowid, fk_user_author, datec, label, note as message, code";
|
||||
$sql = "SELECT id as rowid, fk_user_author, email_from, datec, label, note as message, code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
|
||||
$sql .= " WHERE fk_element = ".(int) $this->id;
|
||||
$sql .= " AND elementtype = 'ticket'";
|
||||
|
|
@ -1774,6 +1777,9 @@ class Ticket extends CommonObject
|
|||
$obj = $this->db->fetch_object($resql);
|
||||
$this->cache_msgs_ticket[$i]['id'] = $obj->rowid;
|
||||
$this->cache_msgs_ticket[$i]['fk_user_author'] = $obj->fk_user_author;
|
||||
if ($obj->code == 'TICKET_MSG' && empty($obj->fk_user_author)) {
|
||||
$this->cache_msgs_ticket[$i]['fk_contact_author'] = $obj->email_from;
|
||||
}
|
||||
$this->cache_msgs_ticket[$i]['datec'] = $this->db->jdate($obj->datec);
|
||||
$this->cache_msgs_ticket[$i]['subject'] = $obj->label;
|
||||
$this->cache_msgs_ticket[$i]['message'] = $obj->message;
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ class ContactTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$result=$localobject->getFullAddress(1);
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertContains("New address\nNew zip New town\nBelgium", $result);
|
||||
$this->assertStringContainsString("New address\nNew zip New town\nBelgium", $result);
|
||||
|
||||
$localobject->info($localobject->id);
|
||||
print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
|
||||
|
|
@ -359,7 +359,7 @@ class ContactTest extends PHPUnit\Framework\TestCase
|
|||
$localobjectadd->town='New town';
|
||||
$result=$localobjectadd->getFullAddress(1);
|
||||
print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
|
||||
$this->assertContains("New address\nNew zip New town\nFrance", $result);
|
||||
$this->assertStringContainsString("New address\nNew zip New town\nFrance", $result);
|
||||
|
||||
// Belgium
|
||||
unset($localobjectadd->country_code);
|
||||
|
|
@ -370,7 +370,7 @@ class ContactTest extends PHPUnit\Framework\TestCase
|
|||
$localobjectadd->town='New town';
|
||||
$result=$localobjectadd->getFullAddress(1);
|
||||
print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
|
||||
$this->assertContains("New address\nNew zip New town\nBelgium", $result);
|
||||
$this->assertStringContainsString("New address\nNew zip New town\nBelgium", $result);
|
||||
|
||||
// Switzerland
|
||||
unset($localobjectadd->country_code);
|
||||
|
|
@ -381,7 +381,7 @@ class ContactTest extends PHPUnit\Framework\TestCase
|
|||
$localobjectadd->town='New town';
|
||||
$result=$localobjectadd->getFullAddress(1);
|
||||
print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
|
||||
$this->assertContains("New address\nNew zip New town\nSwitzerland", $result);
|
||||
$this->assertStringContainsString("New address\nNew zip New town\nSwitzerland", $result);
|
||||
|
||||
// USA
|
||||
unset($localobjectadd->country_code);
|
||||
|
|
@ -392,7 +392,7 @@ class ContactTest extends PHPUnit\Framework\TestCase
|
|||
$localobjectadd->town='New town';
|
||||
$result=$localobjectadd->getFullAddress(1);
|
||||
print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
|
||||
$this->assertContains("New address\nNew town, New zip\nUnited States", $result);
|
||||
$this->assertStringContainsString("New address\nNew town, New zip\nUnited States", $result);
|
||||
|
||||
return $localobjectadd->id;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue