mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-21 17:01:19 +01:00
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into
develop_dict Conflicts: htdocs/install/mysql/migration/6.0.0-7.0.0.sql
This commit is contained in:
@@ -2322,10 +2322,6 @@ class Form
|
||||
unset($producttmpselect);
|
||||
}
|
||||
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||
}
|
||||
// mode=2 means suppliers products
|
||||
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
|
||||
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||
@@ -2333,11 +2329,6 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||
print '<script type="text/javascript">$("#'.$htmlname.'").change(function() { $("#idprod").val($(this).val());});</script>';
|
||||
}
|
||||
print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0,0,$alsoproductwithnosupplierprice);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
* Ex: array('disabled'=> )
|
||||
* Ex: array('show'=> )
|
||||
* Ex: array('update_textarea'=> )
|
||||
* Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax)
|
||||
* @return string Script
|
||||
*/
|
||||
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
|
||||
@@ -146,6 +147,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
|
||||
// Disable an element
|
||||
if (options.option_disabled) {
|
||||
console.log("Make action option_disabled on #"+options.option_disabled+" with disabled="+ui.item.disabled)
|
||||
if (ui.item.disabled) {
|
||||
$("#" + options.option_disabled).prop("disabled", true);
|
||||
if (options.error) {
|
||||
@@ -154,28 +156,32 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
if (options.warning) {
|
||||
$.jnotify(options.warning, "warning", false); // Output with jnotify the warning message
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
$("#" + options.option_disabled).removeAttr("disabled");
|
||||
}
|
||||
}
|
||||
if (options.disabled) {
|
||||
console.log("Make action disabled on each "+options.option_disabled)
|
||||
$.each(options.disabled, function(key, value) {
|
||||
$("#" + value).prop("disabled", true);
|
||||
});
|
||||
}
|
||||
if (options.show) {
|
||||
console.log("Make action show on each "+options.show)
|
||||
$.each(options.show, function(key, value) {
|
||||
$("#" + value).show().trigger("show");
|
||||
});
|
||||
}
|
||||
// Update an input
|
||||
if (ui.item.update) {
|
||||
console.log("Make action update on each ui.item.update")
|
||||
// loop on each "update" fields
|
||||
$.each(ui.item.update, function(key, value) {
|
||||
$("#" + key).val(value).trigger("change");
|
||||
});
|
||||
}
|
||||
if (ui.item.textarea) {
|
||||
console.log("Make action textarea on each ui.item.textarea")
|
||||
$.each(ui.item.textarea, function(key, value) {
|
||||
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") {
|
||||
CKEDITOR.instances[key].setData(value);
|
||||
@@ -192,7 +198,6 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
}
|
||||
,delay: 500
|
||||
}).data("'.$dataforrenderITem.'")._renderItem = function( ul, item ) {
|
||||
|
||||
return $("<li>")
|
||||
.data( "'.$dataforitem.'", item ) // jQuery UI > 1.10.0
|
||||
.append( \'<a><span class="tag">\' + item.label + "</span></a>" )
|
||||
|
||||
@@ -193,8 +193,9 @@ function getBrowserInfo($user_agent)
|
||||
}
|
||||
|
||||
// OS
|
||||
if (preg_match('/linux/i', $user_agent)) { $os='linux'; }
|
||||
if (preg_match('/linux/i', $user_agent)) { $os='linux'; }
|
||||
elseif (preg_match('/macintosh/i', $user_agent)) { $os='macintosh'; }
|
||||
elseif (preg_match('/windows/i', $user_agent)) { $os='windows'; }
|
||||
|
||||
// Name
|
||||
if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='firefox'; $version=$reg[2]; }
|
||||
@@ -204,7 +205,8 @@ function getBrowserInfo($user_agent)
|
||||
elseif (preg_match('/epiphany/i', $user_agent)) { $name='epiphany'; }
|
||||
elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='safari'; $version=$reg[2]; } // Safari is often present in string for mobile but its not.
|
||||
elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='opera'; $version=$reg[2]; }
|
||||
elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end
|
||||
elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end
|
||||
elseif (preg_match('/(Windows NT\s([0-9]+\.[0-9])).*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end
|
||||
elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { $name='lynxlinks'; $version=$reg[4]; }
|
||||
|
||||
if ($tablet) {
|
||||
@@ -1193,10 +1195,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
$nophoto='';
|
||||
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"></div>';
|
||||
}
|
||||
elseif ($conf->browser->layout != 'phone') { // Show no photo link
|
||||
//elseif ($conf->browser->layout != 'phone') { // Show no photo link
|
||||
$nophoto='/public/theme/common/nophoto.png';
|
||||
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1273,7 +1275,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
}
|
||||
}
|
||||
|
||||
if (! $phototoshow && $conf->browser->layout != 'phone') // Show No photo link (picto of pbject)
|
||||
if (! $phototoshow) // Show No photo link (picto of pbject)
|
||||
{
|
||||
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">';
|
||||
if ($object->element == 'action')
|
||||
@@ -1291,6 +1293,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
}
|
||||
$morehtmlleft.='<!-- No photo to show -->';
|
||||
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').' src="'.$nophoto.'"></div></div>';
|
||||
|
||||
$morehtmlleft.='</div>';
|
||||
}
|
||||
}
|
||||
@@ -6460,7 +6463,7 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
|
||||
|
||||
/**
|
||||
* Return value from dictionary
|
||||
*
|
||||
*
|
||||
* @param string $tablename name of dictionary
|
||||
* @param string $field the value to return
|
||||
* @param int $id id of line
|
||||
@@ -6470,13 +6473,13 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
|
||||
function getDictvalue($tablename, $field, $id, $checkentity=false, $rowidfield='rowid')
|
||||
{
|
||||
global $dictvalues,$db,$langs;
|
||||
|
||||
|
||||
if (!isset($dictvalues[$tablename]))
|
||||
{
|
||||
$dictvalues[$tablename] = array();
|
||||
$sql = 'SELECT * FROM '.$tablename.' WHERE 1';
|
||||
if ($checkentity) $sql.= ' entity IN (0,'.getEntity('').')';
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -6490,7 +6493,7 @@ function getDictvalue($tablename, $field, $id, $checkentity=false, $rowidfield='
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($dictvalues[$tablename][$id])) return $dictvalues[$tablename][$id]->{$field}; // Found
|
||||
else // Not found
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* $langs
|
||||
* $dateSelector
|
||||
* $forceall (0 by default, 1 for supplier invoices/orders)
|
||||
* $senderissupplier (0 by default, 1 for supplier invoices/orders)
|
||||
* $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders)
|
||||
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
|
||||
*/
|
||||
|
||||
@@ -208,12 +208,13 @@ else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum
|
||||
if ($senderissupplier != 2)
|
||||
{
|
||||
$ajaxoptions=array(
|
||||
'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
|
||||
'option_disabled' => 'addPredefinedProductButton', // html id to disable once select is done
|
||||
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error'
|
||||
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
|
||||
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo)
|
||||
);
|
||||
$alsoproductwithnosupplierprice=0;
|
||||
}
|
||||
@@ -222,6 +223,7 @@ else {
|
||||
$ajaxoptions = array();
|
||||
$alsoproductwithnosupplierprice=1;
|
||||
}
|
||||
|
||||
$form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice);
|
||||
}
|
||||
echo '</span>';
|
||||
|
||||
Reference in New Issue
Block a user