Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 18.0

This commit is contained in:
Laurent Destailleur 2023-11-16 15:50:02 +01:00
commit f375c41ebb
7 changed files with 42 additions and 20 deletions

View file

@ -156,12 +156,13 @@ class Orders extends DolibarrApi
* @param int $page Page number
* @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @param string $sqlfilterlines Other criteria to filter answers separated by a comma. Syntax example "(tl.fk_product:=:'17') and (tl.price:<:'250')"
* @return array Array of order objects
*
* @throws RestException 404 Not found
* @throws RestException 503 Error
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $sqlfilterlines = '')
{
global $db, $conf;
@ -212,7 +213,16 @@ class Orders extends DolibarrApi
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
}
// Add sql filters for lines
if ($sqlfilterlines) {
$errormessage = '';
$sql .= " AND EXISTS (SELECT tl.rowid FROM ".MAIN_DB_PREFIX."commandedet AS tl WHERE tl.fk_commande = t.rowid";
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilterlines, $errormessage);
$sql .= ")";
if ($errormessage) {
throw new RestException(400, 'Error when validating parameter sqlfilterlines -> '.$errormessage);
}
}
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0) {

View file

@ -81,7 +81,7 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel',
if (empty($object->id)) {
$object->fetch($id); // Fetch may not be already done
}
$result = $object->update_note(dol_html_entity_decode(GETPOST('note_private', 'restricthtml'), ENT_QUOTES | ENT_HTML5), '_private');
$result = $object->update_note(dol_html_entity_decode(GETPOST('note_private', 'restricthtml'), ENT_QUOTES | ENT_HTML5, 'UTF-8', 1), '_private');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}

View file

@ -93,11 +93,12 @@ class SupplierOrders extends DolibarrApi
* @param string $product_ids Product ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
* @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
* @param string $sqlfilterlines Other criteria to filter answers separated by a comma. Syntax example "(tl.fk_product:=:'17') and (tl.price:<:'250')"
* @return array Array of order objects
*
* @throws RestException
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $product_ids = '', $status = '', $sqlfilters = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $product_ids = '', $status = '', $sqlfilters = '', $sqlfilterlines = '')
{
global $db, $conf;
@ -181,6 +182,16 @@ class SupplierOrders extends DolibarrApi
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
}
// Add sql filters for lines
if ($sqlfilterlines) {
$errormessage = '';
$sql .= " AND EXISTS (SELECT tl.rowid FROM ".MAIN_DB_PREFIX."commande_fournisseurdet AS tl WHERE tl.fk_commande = t.rowid";
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilterlines, $errormessage);
$sql .= ")";
if ($errormessage) {
throw new RestException(400, 'Error when validating parameter sqlfilterlines -> '.$errormessage);
}
}
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) {

View file

@ -352,6 +352,7 @@ PackagingForThisProductDesc=You will automaticaly purchase a multiple of this qu
QtyRecalculatedWithPackaging=The quantity of the line were recalculated according to supplier packaging
#Attributes
Attributes=Attributes
VariantAttributes=Variant attributes
ProductAttributes=Variant attributes for products
ProductAttributeName=Variant attribute %s

View file

@ -352,6 +352,7 @@ PackagingForThisProductDesc=Vous achèterez automatiquement un multiple de cette
QtyRecalculatedWithPackaging=La quantité de la ligne a été recalculée en fonction de l'emballage du fournisseur
#Attributes
Attributes=Attributs
VariantAttributes=Attributs de variante
ProductAttributes=Attributs de variantes pour les produits
ProductAttributeName=Attribut de variante %s

View file

@ -97,11 +97,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
//$result = restrictedArea($user, 'mymodule', $id);
//Parameters Page
$param = '&id='.$object->id;
$paramwithsearch = '';
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
$paramwithsearch .= '&limit='.((int) $limit);
}
$paramwithsearch = $param;
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
@ -459,7 +458,7 @@ if ($action == 'clone') {
// Confirmation to close
if ($action == 'record') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Close'), $langs->trans('ConfirmFinish'), 'update', '', 0, 1);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&page='.$page.$paramwithsearch, $langs->trans('Close'), $langs->trans('ConfirmFinish'), 'update', '', 0, 1);
$action = 'view';
}
@ -583,13 +582,13 @@ if ($action != 'record') {
// Save
if ($object->status == $object::STATUS_VALIDATED) {
if ($permissiontoadd) {
print '<a class="butAction classfortooltip" id="idbuttonmakemovementandclose" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=record&token='.newToken().'" title="'.dol_escape_htmltag($langs->trans("MakeMovementsAndClose")).'">'.$langs->trans("MakeMovementsAndClose").'</a>'."\n";
print '<a class="butAction classfortooltip" id="idbuttonmakemovementandclose" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=record&page='.$page.$paramwithsearch.'&token='.newToken().'" title="'.dol_escape_htmltag($langs->trans("MakeMovementsAndClose")).'">'.$langs->trans("MakeMovementsAndClose").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('MakeMovementsAndClose').'</a>'."\n";
}
if ($permissiontoadd) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_cancel&token='.newToken().'">'.$langs->trans("Cancel").'</a>'."\n";
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_cancel&page='.$page.$paramwithsearch.'&token='.newToken().'">'.$langs->trans("Cancel").'</a>'."\n";
}
}
}
@ -990,7 +989,7 @@ if ($resql) {
$num = $db->num_rows($resql);
if (!empty($limit != 0) || $num > $limit || $page) {
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '<li class="pagination"><span>' . $langs->trans("Page") . ' ' . ($page + 1) . '</span></li>', '', $limit);
print_fleche_navigation($page, $_SERVER["PHP_SELF"], '&id='.$object->id.$paramwithsearch, ($num >= $limit), '<li class="pagination"><span>' . $langs->trans("Page") . ' ' . ($page + 1) . '</span></li>', '', $limit);
}
$i = 0;
@ -1206,38 +1205,38 @@ print '<script type="text/javascript">
$(".paginationnext:last").click(function(e){
var form = $("#formrecord");
var actionURL = "'.$_SERVER['PHP_SELF']."?page=".($page).$paramwithsearch.'";
var actionURL = "'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&page='.($page).$paramwithsearch.'";
$.ajax({
url: actionURL,
data: form.serialize(),
cache: false,
success: function(result){
window.location.href = "'.$_SERVER['PHP_SELF']."?page=".($page + 1).$paramwithsearch.'";
window.location.href = "'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&page='.($page + 1).$paramwithsearch.'";
}});
});
$(".paginationprevious:last").click(function(e){
var form = $("#formrecord");
var actionURL = "'.$_SERVER['PHP_SELF']."?page=".($page).$paramwithsearch.'";
var actionURL = "'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&page='.($page).$paramwithsearch.'";
$.ajax({
url: actionURL,
data: form.serialize(),
cache: false,
success: function(result){
window.location.href = "'.$_SERVER['PHP_SELF']."?page=".($page - 1).$paramwithsearch.'";
window.location.href = "'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&page='.($page - 1).$paramwithsearch.'";
}});
});
$("#idbuttonmakemovementandclose").click(function(e){
var form = $("#formrecord");
var actionURL = "'.$_SERVER['PHP_SELF']."?page=".($page).$paramwithsearch.'";
var actionURL = "'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&page='.($page).$paramwithsearch.'";
$.ajax({
url: actionURL,
data: form.serialize(),
cache: false,
success: function(result){
window.location.href = "'.$_SERVER['PHP_SELF']."?page=".($page - 1).$paramwithsearch.'&action=record";
window.location.href = "'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&page='.($page - 1).$paramwithsearch.'&action=record";
}});
});
});

View file

@ -689,7 +689,7 @@ if (!empty($id) || !empty($ref)) {
if (is_array($productCombination2ValuePairs1) && count($productCombination2ValuePairs1)) {
?>
<tr>
<td class="titlefieldcreate tdtop"><label for="features"><?php echo $langs->trans('Combination') ?></label></td>
<td class="titlefieldcreate tdtop"><label for="features"><?php echo $langs->trans('Attributes') ?></label></td>
<td class="tdtop">
<div class="inline-block valignmiddle quatrevingtpercent">
<?php
@ -698,7 +698,7 @@ if (!empty($id) || !empty($ref)) {
$result2 = $prodattr_val->fetch($val->fk_prod_attr_val);
//print 'rr'.$result1.' '.$result2;
if ($result1 > 0 && $result2 > 0) {
print $prodattr->label.' - '.$prodattr_val->value.'<br>';
print $prodattr->label.' : '.$prodattr_val->value.'<br>';
// TODO Add delete link
}
}
@ -910,7 +910,7 @@ if (!empty($id) || !empty($ref)) {
}
?>
<td class="liste_titre"><?php echo $langs->trans('Product') ?></td>
<td class="liste_titre"><?php echo $langs->trans('Combination') ?></td>
<td class="liste_titre"><?php echo $langs->trans('Attributes') ?></td>
<td class="liste_titre right"><?php echo $langs->trans('PriceImpact') ?></td>
<?php if ($object->isProduct()) {
print'<td class="liste_titre right">'.$langs->trans('WeightImpact').'</td>';