Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
5b68c6af62
1
htdocs/admin/dolistore/ajax/index.html
Normal file
1
htdocs/admin/dolistore/ajax/index.html
Normal file
@ -0,0 +1 @@
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2021 Alexis LAURIER <contact@alexislaurier.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
|
||||
@ -307,12 +308,28 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
//var_dump($api->r->apiVersionMap);
|
||||
//exit;
|
||||
|
||||
// We do not want that restler output data if we use native compression (default behaviour) but we want to have it returned into a string.
|
||||
Luracast\Restler\Defaults::$returnResponse = (empty($conf->global->API_DISABLE_COMPRESSION) && !empty($_SERVER['HTTP_ACCEPT_ENCODING']));
|
||||
|
||||
// Call API (we suppose we found it).
|
||||
// The handle will use the file api/temp/routes.php to get data to run the API. If the file exists and the entry for API is not found, it will return 404.
|
||||
$result = $api->r->handle();
|
||||
|
||||
//Luracast\Restler\Defaults::$returnResponse = true;
|
||||
//print $api->r->handle();
|
||||
if (Luracast\Restler\Defaults::$returnResponse) {
|
||||
// We try to compress data
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress')) {
|
||||
header('Content-Encoding: br');
|
||||
$result = brotli_compress($result, 11, BROTLI_TEXT);
|
||||
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) {
|
||||
header('Content-Encoding: bz');
|
||||
$result = bzcompress($result, 9);
|
||||
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) {
|
||||
header('Content-Encoding: gzip');
|
||||
$result = gzencode($result, 9);
|
||||
}
|
||||
|
||||
$api->r->handle();
|
||||
// Restler did not output data yet, we return it now
|
||||
echo $result;
|
||||
}
|
||||
|
||||
//session_destroy();
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
|
||||
@ -83,6 +84,7 @@ if (!$sortorder) {
|
||||
*/
|
||||
|
||||
$tva_static = new Tva($db);
|
||||
$ptva_static = new PaymentVat($db);
|
||||
$socialcontrib = new ChargeSociales($db);
|
||||
$payment_sc_static = new PaymentSocialContribution($db);
|
||||
$sal_static = new Salary($db);
|
||||
@ -271,20 +273,21 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
|
||||
print load_fiche_titre($langs->trans("VATDeclarations").($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', '');
|
||||
|
||||
$sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.fk_bank,";
|
||||
$sql = "SELECT ptva.rowid, pv.rowid as id_tva, pv.amount as amount_tva, ptva.amount, pv.label, pv.datev as dm, ptva.datep as date_payment, ptva.fk_bank,";
|
||||
$sql .= " pct.code as payment_code,";
|
||||
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."tva as pv";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_vat as ptva ON (ptva.fk_tva = pv.rowid)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON (ptva.fk_bank = b.rowid)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON ptva.fk_typepaiement = pct.id";
|
||||
$sql .= " WHERE pv.entity IN (".getEntity("tax").")";
|
||||
if ($year > 0) {
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||
$sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
}
|
||||
if (preg_match('/^pv\./', $sortfield)) {
|
||||
if (preg_match('/^pv\./', $sortfield) || preg_match('/^ptva\./', $sortfield)) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
}
|
||||
|
||||
@ -298,13 +301,13 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'width="140px"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "pv.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "pv.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "ptva.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "ptva.datep", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "ptva.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
$var = 1;
|
||||
while ($i < $num) {
|
||||
@ -316,17 +319,19 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->dm), 'day').'</td>'."\n";
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
$tva_static->id = $obj->id_tva;
|
||||
$tva_static->ref = $obj->label;
|
||||
print "<td>".$tva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td class="right">'.price($obj->amount)."</td>";
|
||||
print '<td class="right">'.price($obj->amount_tva)."</td>";
|
||||
|
||||
// Ref payment
|
||||
$tva_static->id = $obj->rowid;
|
||||
$tva_static->ref = $obj->rowid;
|
||||
print '<td class="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
$ptva_static->id = $obj->rowid;
|
||||
$ptva_static->ref = $obj->rowid;
|
||||
print '<td class="left">'.$ptva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
// Date
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->dm), 'day')."</td>\n";
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_payment), 'day')."</td>\n";
|
||||
|
||||
// Type payment
|
||||
print '<td>';
|
||||
@ -360,7 +365,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="right">'.price($total).'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
@ -440,9 +445,9 @@ while ($j < $numlt) {
|
||||
print '<td class="right">'.price($obj->amount)."</td>";
|
||||
|
||||
// Ref payment
|
||||
$tva_static->id = $obj->rowid;
|
||||
$tva_static->ref = $obj->rowid;
|
||||
print '<td class="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
$ptva_static->id = $obj->rowid;
|
||||
$ptva_static->ref = $obj->rowid;
|
||||
print '<td class="left">'.$ptva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->dp), 'day')."</td>\n";
|
||||
print '<td class="right">'.price($obj->amount)."</td>";
|
||||
|
||||
@ -73,23 +73,23 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
// Read possible payments
|
||||
foreach ($_POST as $key => $value) {
|
||||
if (substr($key, 0, 7) == 'amount_') {
|
||||
$other_chid = substr($key, 7);
|
||||
$amounts[$other_chid] = price2num(GETPOST($key));
|
||||
}
|
||||
}
|
||||
|
||||
if ($amounts[key($amounts)] <= 0) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$paymentid = 0;
|
||||
|
||||
// Read possible payments
|
||||
foreach ($_POST as $key => $value) {
|
||||
if (substr($key, 0, 7) == 'amount_') {
|
||||
$other_chid = substr($key, 7);
|
||||
$amounts[$other_chid] = price2num(GETPOST($key));
|
||||
}
|
||||
}
|
||||
|
||||
if (count($amounts) <= 0) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
|
||||
@ -167,18 +167,18 @@ if ($action == 'search') {
|
||||
}
|
||||
|
||||
$title = $langs->trans('ProductServiceCard');
|
||||
$helpurl = '';
|
||||
$help_url = '';
|
||||
$shortlabel = dol_trunc($object->label, 16);
|
||||
if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) {
|
||||
$title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('AssociatedProducts');
|
||||
$helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||
$help_url = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||
}
|
||||
if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) {
|
||||
$title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('AssociatedProducts');
|
||||
$helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||
$help_url = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||
}
|
||||
|
||||
llxHeader('', $title, $helpurl);
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$head = product_prepare_head($object);
|
||||
$titre = $langs->trans("CardProduct".$object->type);
|
||||
|
||||
1
htdocs/salaries/admin/index.html
Normal file
1
htdocs/salaries/admin/index.html
Normal file
@ -0,0 +1 @@
|
||||
|
||||
@ -234,7 +234,7 @@ $help_url = '';
|
||||
$title = $langs->trans('Salaries');
|
||||
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,";
|
||||
$sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, ps.fk_typepayment as paymenttype, ";
|
||||
$sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment as paymenttype, ";
|
||||
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
|
||||
$sql .= " pst.code as payment_code,";
|
||||
$sql .= " SUM(ps.amount) as alreadypayed";
|
||||
@ -279,7 +279,7 @@ if ($search_type_id) {
|
||||
$sql .= " AND s.fk_typepayment=".$search_type_id;
|
||||
}
|
||||
$sql .= " GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary, u.fk_soc, u.statut,";
|
||||
$sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, ps.fk_typepayment, s.fk_bank,";
|
||||
$sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment, s.fk_bank,";
|
||||
$sql .= " ba.rowid, ba.ref, ba.number, ba.account_number, ba.fk_accountancy_journal, ba.label,";
|
||||
$sql .= " pst.code";
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -74,23 +74,23 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
// Read possible payments
|
||||
foreach ($_POST as $key => $value) {
|
||||
if (substr($key, 0, 7) == 'amount_') {
|
||||
$other_chid = substr($key, 7);
|
||||
$amounts[$other_chid] = price2num($_POST[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($amounts[key($amounts)] <= 0) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$paymentid = 0;
|
||||
|
||||
// Read possible payments
|
||||
foreach ($_POST as $key => $value) {
|
||||
if (substr($key, 0, 7) == 'amount_') {
|
||||
$other_chid = substr($key, 7);
|
||||
$amounts[$other_chid] = price2num($_POST[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($amounts) <= 0) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
@ -271,12 +271,13 @@ if ($action == 'create') {
|
||||
if ($sumpaid < $objp->amount) {
|
||||
$namef = "amount_".$objp->id;
|
||||
$nameRemain = "remain_".$objp->id;
|
||||
/* Disabled, we autofil the amount with remain to pay by default
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'");
|
||||
}
|
||||
} */
|
||||
$remaintopay = $objp->amount - $sumpaid;
|
||||
print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
||||
print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'">';
|
||||
print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'" value="'.$remaintopay.'">';
|
||||
} else {
|
||||
print '-';
|
||||
}
|
||||
|
||||
1
htdocs/salaries/payment_salary/index.html
Normal file
1
htdocs/salaries/payment_salary/index.html
Normal file
@ -0,0 +1 @@
|
||||
|
||||
Loading…
Reference in New Issue
Block a user