Merge remote-tracking branch 'refs/remotes/Dolibarr/3.8' into 3.8

This commit is contained in:
fappels 2015-11-07 09:00:51 +01:00
commit d36a463221
21 changed files with 158 additions and 112 deletions

File diff suppressed because one or more lines are too long

View File

@ -96,7 +96,7 @@ $hookmanager->initHooks(array('actioncard','globalcard'));
/*
* Actions
*/
$listUserAssignedUpdated = false;
// Remove user to assigned list
if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0')
{
@ -114,6 +114,8 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0')
$donotclearsession=1;
if ($action == 'add') $action = 'create';
if ($action == 'update') $action = 'edit';
$listUserAssignedUpdated = true;
}
// Add user to assigned list
@ -133,6 +135,8 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser'))
$donotclearsession=1;
if ($action == 'add') $action = 'create';
if ($action == 'update') $action = 'edit';
$listUserAssignedUpdated = true;
}
// Action clone object
@ -838,6 +842,28 @@ if ($id > 0)
$result4=$object->fetch_userassigned();
$result5=$object->fetch_optionals($id,$extralabels);
if($listUserAssignedUpdated || $donotclearsession) {
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
$object->fk_action = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm');
$object->label = GETPOST("label");
$object->datep = $datep;
$object->datef = $datef;
$object->percentage = $percentage;
$object->priority = GETPOST("priority");
$object->fulldayevent= GETPOST("fullday")?1:0;
$object->location = GETPOST('location');
$object->socid = GETPOST("socid");
$object->contactid = GETPOST("contactid",'int');
//$object->societe->id = $_POST["socid"]; // deprecated
//$object->contact->id = $_POST["contactid"]; // deprecated
$object->fk_project = GETPOST("projectid",'int');
$object->note = GETPOST("note");
}
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
{
dol_print_error($db,$object->error);

View File

@ -544,7 +544,7 @@ if (empty($reshook))
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_remove_file_process($_POST['removedfile'],0);
dol_remove_file_process($_POST['removedfile'],0,0); // We really delete file linked to mailing
$action="edit";
}
@ -1093,7 +1093,10 @@ else
}
print '</table>';
print "</div>";
dol_fiche_end();
print "\n";
print '<form name="edit_mailing" action="card.php" method="post" enctype="multipart/form-data">'."\n";
@ -1103,6 +1106,9 @@ else
// Print mail content
print_fiche_titre($langs->trans("EMail"),'','');
dol_fiche_head();
print '<table class="border" width="100%">';
// Subject
@ -1168,7 +1174,9 @@ else
print '</table>';
print '<br><div class="center">';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'" name="save">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';

View File

@ -284,7 +284,7 @@ if ($result)
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && $user->rights->produit->lire)
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';

View File

@ -453,7 +453,7 @@ class Commande extends CommonOrder
{
$mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products)
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
if ($result < 0) { $error++; }
}
}
@ -637,7 +637,7 @@ class Commande extends CommonOrder
{
$mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products)
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref));
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr",$this->ref)); // price is 0, we don't want WAP to be changed
if ($result < 0)
{
$error++;
@ -984,6 +984,7 @@ class Commande extends CommonOrder
// Clear fields
$this->user_author_id = $user->id;
$this->user_valid = '';
$this->date = dol_now();
$this->date_creation = '';
$this->date_validation = '';
$this->ref_client = '';

View File

@ -281,7 +281,7 @@ if ($resql)
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && $user->rights->produit->lire)
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';

View File

@ -1957,7 +1957,7 @@ if ($action == 'create')
else
{
print '<td colspan="2">';
print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 1);
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 1);
print '</td>';
}
print '</tr>' . "\n";

View File

@ -1890,7 +1890,7 @@ class Facture extends CommonInvoice
$mouvP = new MouvementStock($this->db);
$mouvP->origin = &$this;
// We decrease stock for product
if ($this->type == self::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num));
if ($this->type == self::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr",$num));
else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num));
if ($result < 0) {
$error++;
@ -3672,11 +3672,16 @@ class Facture extends CommonInvoice
/**
* Checks if the invoice is the last in its cycle
*
* @return int 0 or 1 if OK, -1 if error
* @return bool Last of the cycle status
*
*/
function is_last_in_cycle()
{
if (empty($this->situation_cycle_ref)) {
// No point in testing anything if we're not inside a cycle
return false;
}
$sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref;
$resql = $this->db->query($sql);
@ -3687,8 +3692,7 @@ class Facture extends CommonInvoice
} else {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR);
$this->db->rollback();
return -1;
return false;
}
}

View File

@ -296,7 +296,7 @@ if ($resql)
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && $user->rights->produit->lire)
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';

View File

@ -838,13 +838,14 @@ function unActivateModule($value, $requiredby=1)
}
else
{
// TODO Replace this afte DolibarrModules is moved as abstract class with a try catch to show module is bugged
//print $dir.$modFile;
// TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded
$genericMod = new DolibarrModules($db);
$genericMod->name=preg_replace('/^mod/i','',$modName);
$genericMod->rights_class=strtolower(preg_replace('/^mod/i','',$modName));
$genericMod->const_name='MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',$modName));
dol_syslog("modules::unActivateModule Failed to find module file, we use generic function with name " . $modName);
$genericMod->_remove();
$genericMod->_remove(array());
}
// Desactivation des modules qui dependent de lui

View File

@ -171,6 +171,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
}
});
}
console.log("ajax_autocompleter new value selected, we trigger change");
$("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified
}
,delay: 500

View File

@ -3762,7 +3762,7 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
$path = '';
if (! empty($level) && in_array($modulepart, array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier')))
if (! empty($level) && in_array($modulepart, array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier','mailing')))
{
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);

View File

@ -32,7 +32,7 @@
*
* Parent class for module descriptor class files
*/
abstract class DolibarrModules
class DolibarrModules
{
/**
* @var DoliDb Database handler
@ -199,10 +199,14 @@ abstract class DolibarrModules
*
* @param DoliDB $db Database handler
*/
//public function __construct($db);
public function __construct($db)
{
$this->db = $db;
}
// We should but can't set this as abstract because this will make dolibarr hang
// after migration due to old module not implementing. We must wait PHP is able to make
// a try catch on Fatal error to manage this correctly.
// We need constructor into function unActivateModule into admin.lib.php
/**
* Enables a module.

View File

@ -489,6 +489,7 @@ jQuery(document).ready(function() {
});
$("#prod_entry_mode_predef").on( "click", function() {
console.log("click prod_entry_mode_predef");
setforpredef();
jQuery('#trlinefordates').show();
});
@ -496,6 +497,7 @@ jQuery(document).ready(function() {
/* When changing predefined product, we reload list of supplier prices */
$("#idprod, #idprodfournprice").change(function()
{
console.log("change #idprod, #idprodfournprice, conf->global->MARGIN_TYPE=<?php echo $conf->global->MARGIN_TYPE ?>");
setforpredef();
jQuery('#trlinefordates').show();
@ -506,7 +508,7 @@ jQuery(document).ready(function() {
?>
/* Code for margin */
$("#fournprice_predef options").remove();
$("#fournprice_predef").find("option").remove();
$("#fournprice_predef").hide();
$("#buying_price").val("").show();
/* Call post to load content of combo list fournprice_predef */
@ -516,6 +518,7 @@ jQuery(document).ready(function() {
var options = '';
var defaultkey = '';
var defaultprice = '';
var bestpricefound = 0;
var i = 0;
$(data).each(function() {
if (this.id != 'pmpprice')
@ -523,24 +526,23 @@ jQuery(document).ready(function() {
i++;
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
var defaultbuyprice = '<?php echo ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1')?'bestsupplierprice':''); ?>';
if (i == 1 && this.price > 0 && 'bestsupplierprice' == defaultbuyprice) { defaultkey = this.id; defaultprice = this.price; }
options += '<option value="'+this.id+'" price="'+this.price+'"';
if (this.price > 0 && i == 1) { defaultkey = this.id; defaultprice = this.price; }
options += '>'+this.label+'</option>';
var defaultbuyprice = '<?php echo ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1')?'bestsupplierprice':''); ?>'; // We set here default value to use
console.log(this.id+" "+this.price+" "+defaultbuyprice+" "+(this.price > 0));
if (bestpricefound == 0 && this.price > 0 && 'bestsupplierprice' == defaultbuyprice) { defaultkey = this.id; defaultprice = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
}
if (this.id == 'pmpprice')
{
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
var defaultbuyprice = '<?php echo ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'pmp')?'pmp':''); ?>';
console.log(this.id+" "+this.price+" "+defaultbuyprice);
if (this.price > 0 && 'pmp' == defaultbuyprice) { defaultkey = this.id; defaultprice = this.price; }
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
}
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
});
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
console.log("defaultkey="+defaultkey);
$("#fournprice_predef").html(options).show();
if (defaultkey != '')
{
@ -555,6 +557,7 @@ jQuery(document).ready(function() {
$("#buying_price").val(Math.round(defaultprice,<?php print ($conf->global->MAIN_MAX_DECIMALS_UNIT ? $conf->global->MAIN_MAX_DECIMALS_UNIT : 5); ?>));
$("#fournprice_predef").change(function() {
console.log("change on fournprice_predef");
/* Hide field buying_price according to choice into list (if 'inputprice' or not) */
var linevalue=$(this).find('option:selected').val();
var pricevalue = $(this).find('option:selected').attr("price");

View File

@ -1069,7 +1069,7 @@ class Expedition extends CommonObject
// no lot/serial
// We increment stock of product (and sub-products)
// We use warehouse selected for each line
$result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr", $this->ref));
$result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref)); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0)
{
$error++;$this->errors=$this->errors + $mouvS->errors;
@ -1082,7 +1082,7 @@ class Expedition extends CommonObject
// We use warehouse selected for each line
foreach($lotArray as $lot)
{
$result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->dluo_qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch);
$result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->dluo_qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0)
{
$error++;$this->errors=$this->errors + $mouvS->errors;

View File

@ -38,7 +38,7 @@ $langs->load('stocks');
/*
* View
*/
*/
top_httphead();
@ -59,7 +59,7 @@ if ($idprod > 0)
$sql.= " WHERE pfp.fk_product = ".$idprod;
$sql.= " AND p.tobuy = 1";
$sql.= " AND s.fournisseur = 1";
$sql.= " ORDER BY s.nom, pfp.ref_fourn DESC";
$sql.= " ORDER BY pfp.unitprice, s.nom, pfp.ref_fourn DESC"; // Best price first
dol_syslog("Ajax::getSupplierPrices", LOG_DEBUG);
$result=$db->query($sql);
@ -117,7 +117,7 @@ if ($idprod > 0)
$label = price($price,0,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit");
if ($objp->ref_fourn) $label.=' ('.$objp->ref_fourn.')';
$prices[] = array("id" => $objp->idprodfournprice, "price" => price($price,0,'',0), "label" => $label, "title" => $title);
$prices[] = array("id" => $objp->idprodfournprice, "price" => price2num($price,0,'',0), "label" => $label, "title" => $title); // For price field, we must use price2num(), for label or title, price()
$i++;
}

View File

@ -84,6 +84,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
if ($id > 0 || ! empty($ref))
{
$ret=$object->fetch($id, $ref);
$object->fetch_thirdparty();
}
$permissionnote=$user->rights->fournisseur->facture->creer; // Used by the include of actions_setnotes.inc.php
@ -1519,7 +1520,7 @@ if ($action == 'create')
if ($cntinvoice>=1)
{
setEventMessage('WarningBillExist','warnings');
echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')';
echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['invoice_supplier'])->getNomUrl(1).')';
}
echo '</td></tr>';
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
@ -2097,10 +2098,10 @@ else
global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax;
$forceall=1; $senderissupplier=1; $dateSelector=0; $inputalsopricewithtax=1;
// Show object lines
if (! empty($object->lines))
$ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, 1);
$ret = $object->printObjectLines($action, $societe, $mysoc, $lineid, 1);
$num=count($object->lines);

View File

@ -43,13 +43,11 @@ $.Jcrop = function(obj,opt)
// Some on-the-fly fixes for MSIE...sigh
if (!('trackDocument' in opt))
{
opt.trackDocument = $.browser.msie ? false : true;
if ($.browser.msie && $.browser.version.split('.')[0] == '8')
opt.trackDocument = true;
opt.trackDocument = true;
}
if (!('keySupport' in opt))
opt.keySupport = $.browser.msie ? false : true;
opt.keySupport = true;
// }}}
// Extend the default options {{{
@ -416,7 +414,7 @@ $.Jcrop = function(obj,opt)
if (options.drawBorders) {
borders = {
top: insertBorder('hline')
.css('top',$.browser.msie?px(-1):px(0)),
.css('top',px(0)),
bottom: insertBorder('hline'),
left: insertBorder('vline'),
right: insertBorder('vline')
@ -965,7 +963,6 @@ $.Jcrop = function(obj,opt)
function newTracker()
{
var trk = $('<div></div>').addClass(cssClass('tracker'));
$.browser.msie && trk.css({ opacity: 0, backgroundColor: 'white' });
return trk;
};

View File

@ -8,10 +8,9 @@
(function($){$.Jcrop=function(obj,opt)
{var obj=obj,opt=opt;if(typeof(obj)!=='object')obj=$(obj)[0];if(typeof(opt)!=='object')opt={};if(!('trackDocument'in opt))
{opt.trackDocument=$.browser.msie?false:true;if($.browser.msie&&$.browser.version.split('.')[0]=='8')
opt.trackDocument=true;}
{opt.trackDocument=true;}
if(!('keySupport'in opt))
opt.keySupport=$.browser.msie?false:true;var defaults={trackDocument:false,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:.6,borderOpacity:.4,handleOpacity:.5,handlePad:5,handleSize:9,handleOffset:5,edgeMargin:14,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,boxWidth:0,boxHeight:0,boundary:8,animationDelay:20,swingSpeed:3,allowSelect:true,allowMove:true,allowResize:true,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){}};var options=defaults;setOptions(opt);var $origimg=$(obj);var $img=$origimg.clone().removeAttr('id').css({position:'absolute'});$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);;if(options.addClass)$div.addClass(options.addClass);var $img2=$('<img />').attr('src',$img.attr('src')).css('position','absolute').width(boundx).height(boundy);var $img_holder=$('<div />').width(pct(100)).height(pct(100)).css({zIndex:310,position:'absolute',overflow:'hidden'}).append($img2);var $hdl_holder=$('<div />').width(pct(100)).height(pct(100)).css('zIndex',320);var $sel=$('<div />').css({position:'absolute',zIndex:300}).insertBefore($img).append($img_holder,$hdl_holder);var bound=options.boundary;var $trk=newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)).css({position:'absolute',top:px(-bound),left:px(-bound),zIndex:290}).mousedown(newSelection);var xlimit,ylimit,xmin,ymin;var xscale,yscale,enabled=true;var docOffset=getPos($img),btndown,lastcurs,dimmed,animating,shift_down;var Coords=function()
opt.keySupport=true;var defaults={trackDocument:false,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:.6,borderOpacity:.4,handleOpacity:.5,handlePad:5,handleSize:9,handleOffset:5,edgeMargin:14,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,boxWidth:0,boxHeight:0,boundary:8,animationDelay:20,swingSpeed:3,allowSelect:true,allowMove:true,allowResize:true,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){}};var options=defaults;setOptions(opt);var $origimg=$(obj);var $img=$origimg.clone().removeAttr('id').css({position:'absolute'});$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);;if(options.addClass)$div.addClass(options.addClass);var $img2=$('<img />').attr('src',$img.attr('src')).css('position','absolute').width(boundx).height(boundy);var $img_holder=$('<div />').width(pct(100)).height(pct(100)).css({zIndex:310,position:'absolute',overflow:'hidden'}).append($img2);var $hdl_holder=$('<div />').width(pct(100)).height(pct(100)).css('zIndex',320);var $sel=$('<div />').css({position:'absolute',zIndex:300}).insertBefore($img).append($img_holder,$hdl_holder);var bound=options.boundary;var $trk=newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)).css({position:'absolute',top:px(-bound),left:px(-bound),zIndex:290}).mousedown(newSelection);var xlimit,ylimit,xmin,ymin;var xscale,yscale,enabled=true;var docOffset=getPos($img),btndown,lastcurs,dimmed,animating,shift_down;var Coords=function()
{var x1=0,y1=0,x2=0,y2=0,ox,oy;function setPressed(pos)
{var pos=rebound(pos);x2=x1=pos[0];y2=y1=pos[1];};function setCurrent(pos)
{var pos=rebound(pos);ox=pos[0]-x2;oy=pos[1]-y2;x2=pos[0];y2=pos[1];};function getOffset()
@ -57,7 +56,7 @@ if(x1>boundx){var delta=x1-boundy;y2-=delta;y1-=delta;}
if(y1>boundy){var delta=y1-boundy;y2-=delta;y1-=delta;}
return makeObj(flipCoords(x1,y1,x2,y2));};function makeObj(a)
{return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]};};return{flipCoords:flipCoords,setPressed:setPressed,setCurrent:setCurrent,getOffset:getOffset,moveOffset:moveOffset,getCorner:getCorner,getFixed:getFixed};}();var Selection=function()
{var start,end,dragmode,awake,hdep=370;var borders={};var handle={};var seehandles=false;var hhs=options.handleOffset;if(options.drawBorders){borders={top:insertBorder('hline').css('top',$.browser.msie?px(-1):px(0)),bottom:insertBorder('hline'),left:insertBorder('vline'),right:insertBorder('vline')};}
{var start,end,dragmode,awake,hdep=370;var borders={};var handle={};var seehandles=false;var hhs=options.handleOffset;if(options.drawBorders){borders={top:insertBorder('hline').css('top',px(0)),bottom:insertBorder('hline'),left:insertBorder('vline'),right:insertBorder('vline')};}
if(options.dragEdges){handle.t=insertDragbar('n');handle.b=insertDragbar('s');handle.r=insertDragbar('e');handle.l=insertDragbar('w');}
options.sideHandles&&createHandles(['n','s','e','w']);options.cornerHandles&&createHandles(['sw','nw','ne','se']);function insertBorder(type)
{var jq=$('<div />').css({position:'absolute',opacity:options.borderOpacity}).addClass(cssClass(type));$img_holder.append(jq);return jq;};function dragDiv(ord,zi)
@ -134,7 +133,7 @@ else
Tracker.setCursor(options.allowSelect?'crosshair':'default');};function newSelection(e)
{if(options.disabled)return false;if(!options.allowSelect)return false;btndown=true;docOffset=getPos($img);Selection.disableHandles();myCursor('crosshair');var pos=mouseAbs(e);Coords.setPressed(pos);Tracker.activateHandlers(selectDrag,doneSelect);KeyManager.watchKeys();Selection.update();e.stopPropagation();e.preventDefault();return false;};function selectDrag(pos)
{Coords.setCurrent(pos);Selection.update();};function newTracker()
{var trk=$('<div></div>').addClass(cssClass('tracker'));$.browser.msie&&trk.css({opacity:0,backgroundColor:'white'});return trk;};function animateTo(a)
{var trk=$('<div></div>').addClass(cssClass('tracker'));return trk;};function animateTo(a)
{var x1=a[0]/xscale,y1=a[1]/yscale,x2=a[2]/xscale,y2=a[3]/yscale;if(animating)return;var animto=Coords.flipCoords(x1,y1,x2,y2);var c=Coords.getFixed();var animat=initcr=[c.x,c.y,c.x2,c.y2];var interv=options.animationDelay;var x=animat[0];var y=animat[1];var x2=animat[2];var y2=animat[3];var ix1=animto[0]-initcr[0];var iy1=animto[1]-initcr[1];var ix2=animto[2]-initcr[2];var iy2=animto[3]-initcr[3];var pcent=0;var velocity=options.swingSpeed;Selection.animMode(true);var animator=function()
{return function()
{pcent+=(100-pcent)/velocity;animat[0]=x+((pcent/100)*ix1);animat[1]=y+((pcent/100)*iy1);animat[2]=x2+((pcent/100)*ix2);animat[3]=y2+((pcent/100)*iy2);if(pcent<100)animateStart();else Selection.done();if(pcent>=99.8)pcent=100;setSelectRaw(animat);};}();function animateStart()

View File

@ -14,7 +14,7 @@
-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE
-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
-- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
-- To set a field as DEFAULT NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
-- To delete orphelins: VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
-- To delete orphelins: VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
@ -30,8 +30,8 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_typ
-- Taiwan VAT Rates
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 2131, 213, '5', '0', 'VAT 5%', 1);
ALTER TABLE llx_societe_rib ADD COLUMN rum varchar(32) after default_rib;
ALTER TABLE llx_societe_rib ADD COLUMN frstrecur varchar(16) default 'FRST' after rum;
ALTER TABLE llx_societe_rib ADD COLUMN rum varchar(32) AFTER default_rib;
ALTER TABLE llx_societe_rib ADD COLUMN frstrecur varchar(16) DEFAULT 'FRST' AFTER rum;
ALTER TABLE llx_cronjob ADD COLUMN entity integer DEFAULT 0;
ALTER TABLE llx_cronjob MODIFY COLUMN params text NULL;
@ -45,16 +45,16 @@ create table llx_loan
tms timestamp,
label varchar(80) NOT NULL,
fk_bank integer,
capital real default 0 NOT NULL,
capital real DEFAULT 0 NOT NULL,
datestart date,
dateend date,
nbterm real,
rate double NOT NULL,
note_private text,
note_public text,
capital_position real default 0,
capital_position real DEFAULT 0,
date_position date,
paid smallint default 0 NOT NULL,
paid smallint DEFAULT 0 NOT NULL,
accountancy_account_capital varchar(32),
accountancy_account_insurance varchar(32),
accountancy_account_interest varchar(32),
@ -83,10 +83,10 @@ create table llx_payment_loan
)ENGINE=innodb;
ALTER TABLE llx_extrafields ADD COLUMN fieldrequired integer DEFAULT 0;
ALTER TABLE llx_extrafields ADD COLUMN perms varchar(255) after fieldrequired;
ALTER TABLE llx_extrafields ADD COLUMN list integer DEFAULT 0 after perms;
ALTER TABLE llx_extrafields ADD COLUMN perms varchar(255) AFTER fieldrequired;
ALTER TABLE llx_extrafields ADD COLUMN list integer DEFAULT 0 AFTER perms;
ALTER TABLE llx_payment_salary ADD COLUMN salary real after datev;
ALTER TABLE llx_payment_salary ADD COLUMN salary real AFTER datev;
ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_ref (num_payment);
ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_user (fk_user, entity);
@ -98,7 +98,7 @@ ALTER TABLE llx_payment_salary ADD CONSTRAINT fk_payment_salary_user FOREIGN KEY
UPDATE llx_projet_task_time SET task_datehour = task_date where task_datehour IS NULL;
ALTER TABLE llx_projet_task_time ADD COLUMN task_date_withhour integer DEFAULT 0 after task_datehour;
ALTER TABLE llx_projet_task_time ADD COLUMN task_date_withhour integer DEFAULT 0 AFTER task_datehour;
ALTER TABLE llx_projet_task MODIFY COLUMN duration_effective real DEFAULT 0 NULL;
ALTER TABLE llx_projet_task MODIFY COLUMN planned_workload real DEFAULT 0 NULL;
@ -129,8 +129,8 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN fk_supplier_price_expressio
ALTER TABLE llx_product ADD COLUMN fk_price_expression integer DEFAULT NULL;
ALTER TABLE llx_product_price ADD COLUMN fk_price_expression integer DEFAULT NULL;
ALTER TABLE llx_product ADD COLUMN fifo double(24,8) after pmp;
ALTER TABLE llx_product ADD COLUMN lifo double(24,8) after fifo;
ALTER TABLE llx_product ADD COLUMN fifo double(24,8) AFTER pmp;
ALTER TABLE llx_product ADD COLUMN lifo double(24,8) AFTER fifo;
--create table for user conf of printing driver
@ -244,7 +244,7 @@ CREATE TABLE llx_expensereport (
fk_user_cancel integer DEFAULT NULL,
fk_statut integer NOT NULL, -- 1=brouillon, 2=validé (attente approb), 4=annulé, 5=approuvé, 6=payed, 99=refusé
fk_c_paiement integer DEFAULT NULL,
paid smallint default 0 NOT NULL,
paid smallint DEFAULT 0 NOT NULL,
note_public text,
note_private text,
detail_refuse varchar(255) DEFAULT NULL,
@ -330,15 +330,15 @@ ALTER TABLE llx_facture_fourn_det_extrafields ADD INDEX idx_facture_fourn_det_ex
ALTER TABLE llx_facture_fourn_det ADD COLUMN special_code integer DEFAULT 0;
ALTER TABLE llx_facture_fourn_det ADD COLUMN rang integer DEFAULT 0;
ALTER TABLE llx_facture_fourn_det ADD COLUMN fk_parent_line integer NULL after fk_facture_fourn;
ALTER TABLE llx_facture_fourn_det ADD COLUMN fk_parent_line integer NULL AFTER fk_facture_fourn;
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN special_code integer DEFAULT 0;
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN rang integer DEFAULT 0;
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN fk_parent_line integer NULL after fk_commande;
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN fk_parent_line integer NULL AFTER fk_commande;
ALTER TABLE llx_projet ADD COLUMN date_close datetime DEFAULT NULL;
ALTER TABLE llx_projet ADD COLUMN fk_user_close integer DEFAULT NULL;
ALTER TABLE llx_projet ADD COLUMN fk_opp_status integer DEFAULT NULL after fk_statut;
ALTER TABLE llx_projet ADD COLUMN fk_opp_status integer DEFAULT NULL AFTER fk_statut;
ALTER TABLE llx_projet ADD COLUMN opp_amount double(24,8) DEFAULT NULL;
@ -430,8 +430,8 @@ CREATE TABLE llx_askpricesupplierdet_extrafields (
-- End Module AskPriceSupplier --
ALTER TABLE llx_commande_fournisseur ADD COLUMN date_approve2 datetime after date_approve;
ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_user_approve2 integer after fk_user_approve;
ALTER TABLE llx_commande_fournisseur ADD COLUMN date_approve2 datetime AFTER date_approve;
ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_user_approve2 integer AFTER fk_user_approve;
ALTER TABLE llx_societe ADD COLUMN fk_incoterms integer;
ALTER TABLE llx_societe ADD COLUMN location_incoterms varchar(255);
@ -476,9 +476,9 @@ ALTER TABLE llx_societe_extrafields DROP INDEX idx_societe_extrafields;
ALTER TABLE llx_societe_extrafields ADD UNIQUE INDEX uk_societe_extrafields (fk_object);
-- Module Donation
ALTER TABLE llx_don ADD COLUMN fk_country integer NOT NULL after country;
ALTER TABLE llx_don ADD COLUMN fk_country integer NOT NULL DEFAULT 0 AFTER country;
ALTER TABLE llx_don CHANGE COLUMN fk_paiement fk_payment integer;
ALTER TABLE llx_don ADD COLUMN paid smallint default 0 NOT NULL after fk_payment;
ALTER TABLE llx_don ADD COLUMN paid smallint DEFAULT 0 NOT NULL AFTER fk_payment;
ALTER TABLE llx_don CHANGE COLUMN fk_don_projet fk_projet integer NULL;
ALTER TABLE llx_don CHANGE COLUMN fk_project fk_projet integer NULL;
@ -569,7 +569,7 @@ create table llx_c_price_global_variable_updater
)ENGINE=innodb;
ALTER TABLE llx_adherent CHANGE COLUMN note note_private text DEFAULT NULL;
ALTER TABLE llx_adherent ADD COLUMN note_public text DEFAULT NULL after note_private;
ALTER TABLE llx_adherent ADD COLUMN note_public text DEFAULT NULL AFTER note_private;
CREATE TABLE IF NOT EXISTS llx_propal_merge_pdf_product (
rowid integer NOT NULL auto_increment PRIMARY KEY,
@ -607,28 +607,28 @@ INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('M2','square
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('M3','cubic meter','m3', 1);
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('L','liter','l', 1);
alter table llx_product add fk_unit integer default NULL;
alter table llx_product add fk_unit integer DEFAULT NULL;
ALTER TABLE llx_product ADD CONSTRAINT fk_product_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
alter table llx_facturedet_rec add fk_unit integer default NULL;
alter table llx_facturedet_rec add fk_unit integer DEFAULT NULL;
ALTER TABLE llx_facturedet_rec ADD CONSTRAINT fk_facturedet_rec_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
alter table llx_facturedet add fk_unit integer default NULL;
alter table llx_facturedet add fk_unit integer DEFAULT NULL;
ALTER TABLE llx_facturedet ADD CONSTRAINT fk_facturedet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
alter table llx_propaldet add fk_unit integer default NULL;
alter table llx_propaldet add fk_unit integer DEFAULT NULL;
ALTER TABLE llx_propaldet ADD CONSTRAINT fk_propaldet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
alter table llx_commandedet add fk_unit integer default NULL;
alter table llx_commandedet add fk_unit integer DEFAULT NULL;
ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
alter table llx_contratdet add fk_unit integer default NULL;
alter table llx_contratdet add fk_unit integer DEFAULT NULL;
ALTER TABLE llx_contratdet ADD CONSTRAINT fk_contratdet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
alter table llx_commande_fournisseurdet add fk_unit integer default NULL;
alter table llx_commande_fournisseurdet add fk_unit integer DEFAULT NULL;
ALTER TABLE llx_commande_fournisseurdet ADD CONSTRAINT fk_commande_fournisseurdet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
alter table llx_facture_fourn_det add fk_unit integer default NULL;
alter table llx_facture_fourn_det add fk_unit integer DEFAULT NULL;
ALTER TABLE llx_facture_fourn_det ADD CONSTRAINT fk_facture_fourn_det_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);

View File

@ -691,6 +691,7 @@ if ((! empty($conf->productbatch->enabled)) && $product->hasbatch())
$sql = "SELECT e.rowid, e.label, e.lieu, ps.reel, ps.pmp, ps.rowid as product_stock_id";
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,";
$sql.= " ".MAIN_DB_PREFIX."product_stock as ps";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product";
$sql.= " WHERE ps.reel != 0";
$sql.= " AND ps.fk_entrepot = e.rowid";
$sql.= " AND e.entity IN (".getEntity('stock', 1).")";