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

This commit is contained in:
Laurent Destailleur 2022-10-15 14:11:04 +02:00
commit 6ae8af440f
23 changed files with 137 additions and 108 deletions

View File

@ -517,38 +517,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
llxHeader('', $title, $help_url);
if (GETPOSTISSET("search_status")) {
if ($search_status == '-1,1') { // TODO : check this test as -1 == Adherent::STATUS_DRAFT and -2 == Adherent::STATUS_EXLCUDED
$title = $langs->trans("MembersListQualified");
}
if ($search_status == Adherent::STATUS_DRAFT) {
$title = $langs->trans("MembersListToValid");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == '') {
$title = $langs->trans("MenuMembersValidated");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'waitingsubscription') {
$title = $langs->trans("MembersWithWaitingSubscription");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'withoutsubscription') {
$title = $langs->trans("MembersWithSubscriptionToReceive");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'uptodate') {
$title = $langs->trans("MembersListUpToDate");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'outofdate') {
$title = $langs->trans("MembersListNotUpToDate");
}
if ((string) $search_status == (string) Adherent::STATUS_RESILIATED) { // The cast to string is required to have test false when search_status is ''
$title = $langs->trans("MembersListResiliated");
}
if ($search_status == Adherent::STATUS_EXCLUDED) {
$title = $langs->trans("MembersListExcluded");
}
} elseif ($action == 'search') {
$title = $langs->trans("MembersListQualified");
}
if ($search_type > 0) {
$membertype = new AdherentType($db);
$result = $membertype->fetch($search_type);

View File

@ -75,6 +75,7 @@ $offsetunit = GETPOST('offsetunittype_duration', 'aZ09');
$remindertype = GETPOST('selectremindertype', 'aZ09');
$modelmail = GETPOST('actioncommsendmodel_mail', 'int');
$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed
$private = GETPOST('private', 'alphanohtml');
if ($complete == 'na' || $complete == -2) {
$complete = -1;
}
@ -695,7 +696,15 @@ if (empty($reshook) && $action == 'update') {
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
}
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
if ($object->elementtype == 'ticket') {
if ($private) {
$object->type_code = 'TICKET_MSG_PRIVATE';
} else {
$object->type_id = dol_getIdFromCode($db, 'AC_EMAIL', 'c_actioncomm');
}
} else {
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
}
$object->label = GETPOST("label", "alphanohtml");
$object->datep = $datep;
$object->datef = $datef;
@ -1694,7 +1703,7 @@ if ($id > 0) {
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : dol_htmlentities($_SERVER["HTTP_REFERER"])).'">';
}
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->code != "TICKET_MSG_PRIVATE") {
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
}
@ -1706,7 +1715,7 @@ if ($id > 0) {
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
// Type of event
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->elementtype != "ticket") {
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
if ($object->type_code != 'AC_OTH_AUTO') {
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
@ -1719,6 +1728,9 @@ if ($id > 0) {
print '</td></tr>';
}
// Private
if ($object->elementtype == 'ticket') print '<tr><td>'.$langs->trans("PrivateEventMessage").'</td><td colspan="3"><input type="checkbox" id="private" name="private" '.(($object->code == 'TICKET_MSG_PRIVATE') ? ' checked' : '').'></td></tr>';
// Title
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
@ -2184,13 +2196,16 @@ if ($id > 0) {
print '<table class="border tableforfield" width="100%">';
// Type
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->elementtype != 'ticket') {
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>';
print $object->getTypePicto();
print $langs->trans("Action".$object->type_code);
print '</td></tr>';
}
// Private
if ($object->elementtype == 'ticket') print '<tr><td class="titlefield">'.$langs->trans("PrivateEventMessage").'</td><td>'.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).'</td></tr>';
// Full day event
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';

View File

@ -950,7 +950,7 @@ abstract class CommonDocGenerator
}
}
if (array_key_exists('option_'.$key, $object->array_options)) {
if (array_key_exists('options_'.$key, $object->array_options)) {
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
} else {
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => ''));

View File

@ -6067,14 +6067,15 @@ abstract class CommonObject
//var_dump('key '.$key.' '.$value.' type='.$extrafields->attributes[$this->table_element]['type'][$key].' '.$this->array_options["options_".$key]);
}
}
}
// If field is a computed field, value must become result of compute
foreach ($tab as $key => $value) {
if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
//var_dump($conf->disable_compute);
if (empty($conf->disable_compute)) {
$this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '');
}
// If field is a computed field, value must become result of compute (regardless of whether a row exists
// in the element's extrafields table)
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
//var_dump($conf->disable_compute);
if (empty($conf->disable_compute)) {
$this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '');
}
}
}

View File

@ -3173,6 +3173,8 @@ class Form
'type'=>$outtype,
'price_ht'=>price2num($outprice_ht),
'price_ttc'=>price2num($outprice_ttc),
'price_ht_locale'=>price(price2num($outprice_ht)),
'price_ttc_locale'=>price(price2num($outprice_ttc)),
'pricebasetype'=>$outpricebasetype,
'tva_tx'=>$outtva_tx,
'default_vat_code'=>$outdefault_vat_code,
@ -3274,9 +3276,9 @@ class Form
$sql .= " pfp.supplier_reputation";
// if we use supplier description of the products
if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) {
$sql .= " ,pfp.desc_fourn as description";
$sql .= ", pfp.desc_fourn as description";
} else {
$sql .= " ,p.description";
$sql .= ", p.description";
}
// Units
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@ -3558,7 +3560,13 @@ class Form
$optstart .= ' disabled';
}
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
$optstart .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'" data-tvatx="'.$objp->tva_tx.'"';
$opt .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
$opt .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
$opt .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
$opt .= ' data-up="'.dol_escape_htmltag($objp->unitprice).'"';
$opt .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
$opt .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
$opt .= ' data-tvatx="'.dol_escape_htmltag($objp->tva_tx).'"';
}
$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
@ -3594,8 +3602,27 @@ class Form
// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
// "label" value of json key array is used by jQuery automatically as text for combo box
$out .= $optstart . ' data-html="'.dol_escape_htmltag($optlabel).'">' . $optlabel . "</option>\n";;
array_push($outarray, $outarrayentry);
array_push(
$outarray,
array('key'=>$outkey,
'value'=>$outref,
'label'=>$outval,
'qty'=>$outqty,
'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
'price_qty_ht_locale'=>price($objp->fprice),
'price_unit_ht_locale'=>price($objp->unitprice),
'tva_tx'=>$objp->tva_tx,
'default_vat_code'=>$objp->default_vat_code,
'discount'=>$outdiscount,
'type'=>$outtype,
'duration_value'=>$outdurationvalue,
'duration_unit'=>$outdurationunit,
'disabled'=>(empty($objp->idprodfournprice) ? true : false),
'description'=>$objp->description
)
);
// Exemple of var_dump $outarray
// array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp"
// ["label"]=>string(76) "ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)"

View File

@ -143,8 +143,12 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
textarea[key] = item[value];
});
}
console.log("Return value from GET to the rest of code");
return { label: label, value: item.value, id: item.key, disabled: item.disabled,
return { label: label,
value: item.value,
id: item.key,
disabled: item.disabled,
update: update,
textarea: textarea,
pbq: item.pbq,
@ -154,6 +158,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
pricebasetype: item.pricebasetype,
price_ht: item.price_ht,
price_ttc: item.price_ttc,
price_unit_ht: item.price_unit_ht,
price_unit_ht_locale: item.price_unit_ht_locale,
description : item.description,
ref_customer: item.ref_customer,
tva_tx: item.tva_tx }
@ -173,6 +179,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
// For supplier price and customer when price by quantity is off
$("#'.$htmlnamejquery.'").attr("data-up", ui.item.price_ht);
$("#'.$htmlnamejquery.'").attr("data-up-locale", ui.item.price_unit_ht_locale);
$("#'.$htmlnamejquery.'").attr("data-base", ui.item.pricebasetype);
$("#'.$htmlnamejquery.'").attr("data-qty", ui.item.qty);
$("#'.$htmlnamejquery.'").attr("data-discount", ui.item.discount);
@ -191,6 +198,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
';
}
$script .= '
// A new value has been selected, we trigger the handlers on #htmlnamejquery
console.log("Trigger changes on #'.$htmlnamejquery.'");
$("#'.$htmlnamejquery.'").val(ui.item.id).trigger("change"); // Select new value
// Complementary actions

View File

@ -18,6 +18,7 @@
* 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>
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -7676,6 +7677,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__PROJECT_REF__'] = (is_object($object->projet) ? $object->projet->ref : '');
$substitutionarray['__PROJECT_NAME__'] = (is_object($object->projet) ? $object->projet->title : '');
}
if (is_object($object) && $object->element == 'project') {
$substitutionarray['__PROJECT_NAME__'] = $object->title;
}
if (is_object($object) && $object->element == 'shipping') {
$substitutionarray['__SHIPPINGTRACKNUM__'] = $object->tracking_number;

View File

@ -292,7 +292,9 @@ if ($nolinesbefore) {
$alsoproductwithnosupplierprice = 0;
} else {
$ajaxoptions = array(
'update' => array('remise_percent' => 'discount', 'price_ht' => 'price_ht') // html id tags that will be edited with each ajax json response key
// Disabled: This is useless because setting discount and price_ht after a selection is already managed
// by ths page itself with a .change on the combolist '#idprodfournprice'
//'update' => array('remise_percent' => 'discount', 'price_ht' => 'price_ht') // html id tags that will be edited with each ajax json response key
);
$alsoproductwithnosupplierprice = 1;
}
@ -712,7 +714,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
/* When changing predefined product, we reload list of supplier prices required for margin combo */
$("#idprod, #idprodfournprice").change(function()
{
console.log("Call method change() after change on #idprod or #idprodfournprice (senderissupplier=<?php echo $senderissupplier; ?>). this.val = "+$(this).val());
console.log("objectline_create.tpl Call method change() after change on #idprod or #idprodfournprice (senderissupplier=<?php echo $senderissupplier; ?>). this.val = "+$(this).val());
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva
jQuery('#trlinefordates').show();
@ -725,7 +727,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0)
{
console.log("We are in a price per qty context, we do not call ajax/product, init of fields is done few lines later");
console.log("objectline_create.tpl We are in a price per qty context, we do not call ajax/product, init of fields is done few lines later");
} else {
<?php if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { ?>
if (isNaN(pbq)) { console.log("We use experimental option PRODUIT_CUSTOMER_PRICES_BY_QTY or PRODUIT_CUSTOMER_PRICES_BY_QTY but we could not get the id of pbq from product combo list, so load of price may be 0 if product has differet prices"); }
@ -735,7 +737,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
$.post('<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch',
{ 'id': $(this).val(), 'socid': <?php print $object->socid; ?> },
function(data) {
console.log("Load unit price end, we got value ht="+data.price_ht+" ttc="+data.price_ttc+" pricebasetype="+data.pricebasetype);
console.log("objectline_create.tpl Load unit price end, we got value ht="+data.price_ht+" ttc="+data.price_ttc+" pricebasetype="+data.pricebasetype);
$('#date_start').removeAttr('type');
$('#date_end').removeAttr('type');
@ -757,8 +759,10 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
}
if (<?php echo (int) $inputalsopricewithtax; ?> == 1 && data.pricebasetype == 'TTC') {
console.log("objectline_create.tpl set content of price_ttc");
jQuery("#price_ttc").val(data.price_ttc);
} else {
console.log("objectline_create.tpl set content of price_ht");
jQuery("#price_ht").val(data.price_ht);
}
<?php
@ -770,7 +774,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
var proddesc = data.desc;
<?php
} ?>
console.log("Load desciption into text area : "+proddesc);
console.log("objectline_create.tpl Load desciption into text area : "+proddesc);
<?php
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?>
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
@ -790,7 +794,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
<?php
if (!empty($conf->global->PRODUCT_LOAD_EXTRAFIELD_INTO_OBJECTLINES)) { ?>
jQuery.each(data.array_options, function( key, value ) {
jQuery('div[class$="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value);
jQuery('div[class*="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value);
});
<?php
} ?>
@ -834,7 +838,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
print 'costprice';
}
} ?>';
console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice);
console.log("objectline_create.tpl we will set the field for margin. defaultbuyprice="+defaultbuyprice);
var i = 0;
$(data).each(function() {
@ -945,11 +949,16 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
<?php
}
?>
//Deal with supplier
if (jQuery('#idprodfournprice').val() >0)
// Deal with supplier
if (jQuery('#idprodfournprice').val() > 0)
{
console.log("objectline_create.tpl #idprodfournprice is > 0, so we set some properties into page");
var up = parseFloat($('option:selected', this).attr('data-up')); // When select is done from HTML select
if (isNaN(up)) { up = parseFloat(jQuery('#idprodfournprice').attr('data-up'));} // When select is done from HTML input with autocomplete
if (isNaN(up)) { up = parseFloat(jQuery('#idprodfournprice').attr('data-up'));} // When select is done from HTML input with ajax autocomplete
var up_locale = $('option:selected', this).attr('data-up-locale'); // When select is done from HTML select
if (typeof up_locale === 'undefined') { up_locale = jQuery('#idprodfournprice').attr('data-up-locale');} // When select is done from HTML input with ajax autocomplete
var qty = parseFloat($('option:selected', this).attr('data-qty'));
if (isNaN(qty)) { qty = parseFloat(jQuery('#idprodfournprice').attr('data-qty'));}
@ -958,11 +967,15 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));}
var tva_tx = parseFloat($('option:selected', this).attr('data-tvatx')); // When select is done from HTML select
if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery('#idprodfournprice').attr('data-tvatx'));} // When select is done from HTML input with autocomplete
if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery('#idprodfournprice').attr('data-tvatx'));} // When select is done from HTML input with ajax autocomplete
console.log("We find supplier price :"+up+" qty: "+qty+" tva_tx="+tva_tx+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val());
console.log("objectline_create.tpl We find supplier price : up = "+up+", up_locale = "+up_locale+", qty = "+qty+", tva_tx = "+tva_tx+", discount = "+discount+" for product "+jQuery('#idprodfournprice').val());
jQuery("#price_ht").val(up);
if (typeof up_locale === 'undefined') {
jQuery("#price_ht").val(up);
} else {
jQuery("#price_ht").val(up_locale);
}
/* $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); */
$('#tva_tx option').val(tva_tx);
@ -970,8 +983,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
if (jQuery("#qty").val() < qty) {
jQuery("#qty").val(qty);
}
if (jQuery("#remise_percent").val() < discount)
{
if (jQuery("#remise_percent").val() < discount) {
jQuery("#remise_percent").val(discount);
}
@ -1038,7 +1050,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
/* Function to set fields from choice */
function setforfree() {
console.log("Call setforfree. We show most fields");
console.log("objectline_create.tpl::setforfree. We show most fields");
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
jQuery("#prod_entry_mode_free").prop('checked',true).change();
jQuery("#prod_entry_mode_predef").prop('checked',false).change();
@ -1049,7 +1061,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
}
function setforpredef() {
console.log("Call setforpredef. We hide some fields and show dates");
console.log("objectline_create.tpl::setforpredef We hide some fields, show dates");
jQuery("#select_type").val(-1);
jQuery("#prod_entry_mode_free").prop('checked',false).change();
jQuery("#prod_entry_mode_predef").prop('checked',true).change();

View File

@ -3525,7 +3525,7 @@ class Product extends CommonObject
global $db, $conf, $user, $hookmanager;
$sql = "SELECT COUNT(DISTINCT f.fk_soc) as nb_customers, COUNT(DISTINCT f.rowid) as nb,";
$sql .= " COUNT(fd.rowid) as nb_rows, SUM('fd.qty') as qty";
$sql .= " COUNT(fd.rowid) as nb_rows, SUM(fd.qty) as qty";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet_rec as fd";
$sql .= ", ".MAIN_DB_PREFIX."facture_rec as f";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";

View File

@ -259,12 +259,11 @@ if ($id > 0 || !empty($ref)) {
}
$db->free($result);
$option .= '&id='.$product->id;
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.urlencode($limit);
}
if (!empty($id)) {
$option .= '&id='.$product->id;
}
if (!empty($search_month)) {
$option .= '&search_month='.urlencode($search_month);
}

View File

@ -185,13 +185,11 @@ if ($id > 0 || !empty($ref)) {
if ($result) {
$num = $db->num_rows($result);
$option = '';
$option = '&id='.$product->id;
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.urlencode($limit);
}
if (!empty($id)) {
$option .= '&id='.$product->id;
}
if (!empty($search_month)) {
$option .= '&search_month='.urlencode($search_month);
}

View File

@ -185,13 +185,11 @@ if ($id > 0 || !empty($ref)) {
if ($result) {
$num = $db->num_rows($result);
$option = '';
$option = '&id='.$product->id;
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.urlencode($limit);
}
if (!empty($id)) {
$option .= '&id='.$product->id;
}
if (!empty($search_month)) {
$option .= '&search_month='.urlencode($search_month);
}
@ -228,7 +226,7 @@ if ($id > 0 || !empty($ref)) {
$i = 0;
print '<div class="div-table-responsive">';
print '<table class="tagtable liste listwithfilterbefore" width="100%">';
print '<table class="tagtable liste listwithfilterbefore centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "c.rowid", "", $option, '', $sortfield, $sortorder);
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder);

View File

@ -170,12 +170,11 @@ if ($id > 0 || !empty($ref)) {
if ($result) {
$num = $db->num_rows($result);
$option = '&id='.$product->id;
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.urlencode($limit);
}
if (!empty($id)) {
$option .= '&id='.$product->id;
}
if (!empty($search_month)) {
$option .= '&search_month='.urlencode($search_month);
}

View File

@ -201,12 +201,11 @@ if ($id > 0 || !empty($ref)) {
if ($result) {
$num = $db->num_rows($result);
$option .= '&id='.$product->id;
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.urlencode($limit);
}
if (!empty($id)) {
$option .= '&id='.$product->id;
}
if (!empty($search_month)) {
$option .= '&search_month='.urlencode($search_month);
}

View File

@ -184,12 +184,11 @@ if ($id > 0 || !empty($ref)) {
if ($result) {
$num = $db->num_rows($result);
$option .= '&id='.$product->id;
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.urlencode($limit);
}
if (!empty($id)) {
$option .= '&id='.$product->id;
}
if (!empty($search_month)) {
$option .= '&search_month='.urlencode($search_month);
}

View File

@ -202,12 +202,11 @@ if ($id > 0 || !empty($ref)) {
if ($result) {
$num = $db->num_rows($result);
$option = '&id='.$product->id;
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.urlencode($limit);
}
if (!empty($id)) {
$option .= '&id='.$product->id;
}
if (!empty($search_month)) {
$option .= '&search_month='.urlencode($search_month);
}

View File

@ -163,12 +163,11 @@ if ($id > 0 || !empty($ref)) {
if ($result) {
$num = $db->num_rows($result);
$option = '&id='.$product->id;
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.urlencode($limit);
}
if (!empty($id)) {
$option .= '&id='.$product->id;
}
if (!empty($search_month)) {
$option .= '&search_month='.urlencode($search_month);
}

View File

@ -186,12 +186,11 @@ if ($id > 0 || !empty($ref)) {
if ($result) {
$num = $db->num_rows($result);
$option = '&id='.$product->id;
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.urlencode($limit);
}
if (!empty($id)) {
$option .= '&id='.$product->id;
}
if (!empty($search_month)) {
$option .= '&search_month='.urlencode($search_month);
}

View File

@ -185,12 +185,11 @@ if ($id > 0 || !empty($ref)) {
if ($result) {
$num = $db->num_rows($result);
$option = '&id='.$product->id;
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.urlencode($limit);
}
if (!empty($id)) {
$option .= '&id='.$product->id;
}
if (!empty($search_month)) {
$option .= '&search_month='.urlencode($search_month);
}

View File

@ -38,13 +38,13 @@ if (empty($conf) || !is_object($conf)) {
// Other attributes
if (!isset($parameters)) $parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $movement, $action); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
$params = array();
if (isset($tpl_context)) $params['tpl_context'] = $tpl_context;
$params['cols'] = $parameters['colspanvalue'];
print $movement->showOptionals($extrafields, 'create', $params);
print $object->showOptionals($extrafields, 'create', $params);
}
?>

View File

@ -74,7 +74,7 @@ if ($prodattr->fetch($id) < 0) {
$prodattrval = new ProductAttributeValue($db);
$res = $prodattrval->fetchAllByProductAttribute($id);
$res = $prodattrval->fetchAllByProductAttribute($id, false, 1);
if ($res == -1) {
print json_encode(array(

View File

@ -261,9 +261,10 @@ class ProductAttributeValue extends CommonObjectLine
*
* @param int $prodattr_id Product attribute id
* @param bool $only_used Fetch only used attribute values
* @param int $returnonlydata 0: return object, 1: return only data
* @return ProductAttributeValue[] Array of object
*/
public function fetchAllByProductAttribute($prodattr_id, $only_used = false)
public function fetchAllByProductAttribute($prodattr_id, $only_used = false, $returnonlydata = 0)
{
$return = array();
@ -290,7 +291,12 @@ class ProductAttributeValue extends CommonObjectLine
$query = $this->db->query($sql);
while ($result = $this->db->fetch_object($query)) {
$tmp = new ProductAttributeValue($this->db);
if (empty($returnonlydata)) {
$tmp = new ProductAttributeValue($this->db);
} else {
$tmp = new stdClass();
}
$tmp->fk_product_attribute = $result->fk_product_attribute;
$tmp->id = $result->rowid;
$tmp->ref = $result->ref;

View File

@ -496,7 +496,7 @@ if (!empty($id) || !empty($ref)) {
}
if ($action == 'add') {
$prodattr_all = $prodattr->fetchAll();
$prodattr_all = $prodattr->fetchAll(1);
if (!$selected) {
$selected = $prodattr_all[key($prodattr_all)]->id;
@ -507,7 +507,6 @@ if (!empty($id) || !empty($ref)) {
foreach ($prodattr_all as $each) {
$prodattr_alljson[$each->id] = $each;
}
?>
<script type="text/javascript">