From d4ee1836629331109721bcd3f8eba1917a2d7fe0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 4 Nov 2015 18:21:59 +0100 Subject: [PATCH 01/67] FIX : 3880 --- htdocs/fourn/facture/card.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c39128218d5..cd3d0763f13 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -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 @@ -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); From 876ab4bb592204a9dc112f88abee1e0fd9928de1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 4 Nov 2015 18:30:09 +0100 Subject: [PATCH 02/67] FIX : #3882 --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index cd3d0763f13..21aab088fd0 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1520,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 ''; print ''.$langs->trans('TotalHT').''.price($objectsrc->total_ht).''; From c534f5bcd51485747c808c76128b22b60e7cc9f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 4 Nov 2015 20:34:18 +0100 Subject: [PATCH 03/67] Fix #3805 Enhanced Facture::is_last_in_cycle() --- htdocs/compta/facture/class/facture.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index eee909645d7..cfbb0491be2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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; } } From f319976e5df84c248123ff6ef3bba9896005a11b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Nov 2015 03:02:31 +0100 Subject: [PATCH 04/67] FIX #3878 Storing and deleting files on emailing was done at wrong place Conflicts: htdocs/comm/mailing/card.php --- htdocs/comm/mailing/card.php | 14 +++++++++++--- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index b7d4f909fa7..e1d357b6c3a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -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 ''; - print ""; + + dol_fiche_end(); + + print "\n"; print '
'."\n"; @@ -1103,6 +1106,9 @@ else // Print mail content print_fiche_titre($langs->trans("EMail"),'',''); + + dol_fiche_head(); + print ''; // Subject @@ -1168,7 +1174,9 @@ else print '
'; - print '
'; + dol_fiche_end(); + + print '
'; print ''; print '     '; print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index df6b3d325c5..8c71b882d21 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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); From 015dedc3abcc27dc9f271d23ff68e19200d9f8b1 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Thu, 5 Nov 2015 11:53:45 +0100 Subject: [PATCH 05/67] FIX: Show category selector if we have permission to view products or services --- htdocs/comm/propal/list.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/compta/facture/list.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 1004986ffe5..3f4f692bdcd 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -284,7 +284,7 @@ if ($result) $moreforfilter.='
'; } // 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.='
'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index db11df409f6..517cd95e536 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -281,7 +281,7 @@ if ($resql) $moreforfilter.='
'; } // 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.='
'; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 93874ac5e80..2581bb382ca 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -296,7 +296,7 @@ if ($resql) $moreforfilter.='
'; } // 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.='
'; From e78ebf041a78f8b228392eb8bf4ec074ed4c7192 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Nov 2015 02:02:57 +0100 Subject: [PATCH 06/67] Fix deprecated code not working in jcrop. $.browser.msie and $.browser is no more available in jquery 1.9+. --- htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.js | 9 +++------ .../includes/jquery/plugins/jcrop/js/jquery.Jcrop.min.js | 9 ++++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.js b/htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.js index ad261f97aec..a31a0a10592 100755 --- a/htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.js +++ b/htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.js @@ -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 = $('
').addClass(cssClass('tracker')); - $.browser.msie && trk.css({ opacity: 0, backgroundColor: 'white' }); return trk; }; diff --git a/htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.min.js b/htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.min.js index 9002b9787f2..c3c932b8349 100755 --- a/htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.min.js +++ b/htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.min.js @@ -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=$('
').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=$('').attr('src',$img.attr('src')).css('position','absolute').width(boundx).height(boundy);var $img_holder=$('
').width(pct(100)).height(pct(100)).css({zIndex:310,position:'absolute',overflow:'hidden'}).append($img2);var $hdl_holder=$('
').width(pct(100)).height(pct(100)).css('zIndex',320);var $sel=$('
').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=$('
').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=$('').attr('src',$img.attr('src')).css('position','absolute').width(boundx).height(boundy);var $img_holder=$('
').width(pct(100)).height(pct(100)).css({zIndex:310,position:'absolute',overflow:'hidden'}).append($img2);var $hdl_holder=$('
').width(pct(100)).height(pct(100)).css('zIndex',320);var $sel=$('
').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=$('
').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=$('
').addClass(cssClass('tracker'));$.browser.msie&&trk.css({opacity:0,backgroundColor:'white'});return trk;};function animateTo(a) +{var trk=$('
').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() From 8d829dca320ca0a9c864a9052447a8d55043d483 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 6 Nov 2015 09:49:02 +0100 Subject: [PATCH 07/67] FIX : only active customer should be return into new invoice creation select list --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a69b35c9559..4e05be21c01 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1855,7 +1855,7 @@ if ($action == 'create') else { print ''; - 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 ''; } print '' . "\n"; From 4d11205a01f056dd1a0dd2baf1223e35ef953d60 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 6 Nov 2015 09:51:33 +0100 Subject: [PATCH 08/67] FIX: change object statut on close shipping and remove erratic db commit --- htdocs/expedition/class/expedition.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e68b063d7d2..106befda596 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1542,8 +1542,8 @@ class Expedition extends CommonObject if ($this->db->query($sql) ) { //TODO: Option to set order billed if 100% of order is shipped + $this->statut=2; $this->billed=1; - $this->db->commit(); return 1; } else From 126b5d6ecae5b74f5395638f8de109c7cab62a4f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 6 Nov 2015 10:19:10 +0100 Subject: [PATCH 09/67] FIX : only active customer should be available into select list thirdparty on invoice creation --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9608bd87a0c..191a45831fc 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1957,7 +1957,7 @@ if ($action == 'create') else { print ''; - 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 ''; } print '' . "\n"; From 121d2beb8067fd224d440c90d646f9371fb4398d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 6 Nov 2015 10:34:18 +0100 Subject: [PATCH 10/67] fix spacing --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 191a45831fc..fb6548c3e87 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1957,7 +1957,7 @@ if ($action == 'create') else { print ''; - print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 1); + print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 1); print ''; } print '' . "\n"; From f6b8c3a13030fad347b4dc52df9e0ffa7d59056a Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 6 Nov 2015 10:50:08 +0100 Subject: [PATCH 11/67] FIX : #3912 --- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 2241c35f00d..d31a8853a36 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -476,7 +476,7 @@ 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 CHANGE COLUMN fk_don_projet fk_projet integer NULL; From b0be2b04c7bee60c2f65eb6fde3f2c511ba81d80 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 6 Nov 2015 10:53:33 +0100 Subject: [PATCH 12/67] FIX : #3912 --- .../install/mysql/migration/3.7.0-3.8.0.sql | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index d31a8853a36..965704f5309 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -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 DEFAULT 0 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); From b4c3804c911d458d575ab0ce559e2acbf521ae6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 7 Nov 2015 13:21:03 +0100 Subject: [PATCH 13/67] FIX #3928 Creating a Customer order and a Customer invoice from a project, does not inherit payment conditions and method of payment of customer card --- htdocs/commande/fiche.php | 32 ++++++++++++++++++++++---------- htdocs/compta/facture.php | 23 ++++++++++++++++------- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 9a844b0a5d5..78370bad2cb 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1366,6 +1366,9 @@ if ($action == 'create' && $user->rights->commande->creer) { if ($socid > 0) $res = $soc->fetch($socid); + $projectid = 0; + $remise_absolue = 0; + if (! empty($origin) && ! empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; @@ -1423,17 +1426,26 @@ if ($action == 'create' && $user->rights->commande->creer) { $srccontactslist = $objectsrc->liste_contact(- 1, 'external', 1); } } - else - { - $cond_reglement_id = $soc->cond_reglement_id; - $mode_reglement_id = $soc->mode_reglement_id; - $availability_id = $soc->availability_id; - $demand_reason_id = $soc->demand_reason_id; - $remise_percent = $soc->remise_percent; - $remise_absolue = 0; - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; - $projectid = 0; + + if (!$cond_reglement_id) { + $cond_reglement_id = $soc->cond_reglement_id; } + if (!$mode_reglement_id) { + $mode_reglement_id = $soc->mode_reglement_id; + } + if (!$availability_id) { + $availability_id = $soc->availability_id; + } + if (!$demand_reason_id) { + $demand_reason_id = $soc->demand_reason_id; + } + if (!$remise_percent) { + $remise_percent = $soc->remise_percent; + } + if (!$dateinvoice) { + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : ''; + } + $absolute_discount=$soc->getAvailableDiscounts(); $nbrow = 10; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index af28d80b9e9..0d06394ab69 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1860,6 +1860,8 @@ if ($action == 'create') if ($socid > 0) $res = $soc->fetch($socid); + $remise_absolue = 0; + if (! empty($origin) && ! empty($originid)) { // Parse element/subelement (ex: project_task) @@ -1916,14 +1918,21 @@ if ($action == 'create') } $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : ''; // Dot not set 0 here (0 for a date is 1970) } - else - { - $cond_reglement_id = $soc->cond_reglement_id; - $mode_reglement_id = $soc->mode_reglement_id; - $remise_percent = $soc->remise_percent; - $remise_absolue = 0; - $dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); // Do not set 0 here (0 for a date is 1970) + + if (!$cond_reglement_id) { + $cond_reglement_id = $soc->cond_reglement_id; } + if (!$mode_reglement_id) { + $mode_reglement_id = $soc->mode_reglement_id; + } + if (!$remise_percent) { + $remise_percent = $soc->remise_percent; + } + if (!$dateinvoice) { + // Do not set 0 here (0 for a date is 1970) + $dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); + } + $absolute_discount = $soc->getAvailableDiscounts(); if (! empty($conf->use_javascript_ajax)) From 3bbedf1795c8b93527954af5fc814034b9b94800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 7 Nov 2015 13:39:34 +0100 Subject: [PATCH 14/67] FIX #3707 Thirdparty bank account page table has a glitch --- htdocs/societe/rib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 55f1a111a93..6505ea24f63 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -401,7 +401,14 @@ if ($socid && $action != 'edit' && $action != "create") } if (count($rib_list) == 0) { - print ''.$langs->trans("NoBANRecord").''; + + if (! empty($conf->prelevement->enabled)) { + $colspan = 8; + } else { + $colspan = 7; + } + + print ''.$langs->trans("NoBANRecord").''; } print ''; From 728f469c1e37e9cec1f22686461f8eedf48e8d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 7 Nov 2015 13:43:59 +0100 Subject: [PATCH 15/67] FIX #3890 Expected transactions bank account page, shows negative numbers --- htdocs/compta/bank/treso.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index b9274c34eb5..1b9925e761c 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -2,6 +2,7 @@ /* Copytight (C) 2005-2009 Regis Houssin * Copyright (C) 2008-2009 Laurent Destailleur (Eldy) * Copyright (C) 2008 Raphael Bertrand (Resultic) + * Copyright (C) 2015 Marcos García "; print "".$ref.""; print "".$refcomp.""; - if ($obj->total_ttc < 0) { print "".price($total_ttc)." "; }; + if ($obj->total_ttc < 0) { print "".price(abs($total_ttc))." "; }; if ($obj->total_ttc >= 0) { print " ".price($total_ttc).""; }; print ''.price($solde).''; print ""; From 01854b32597022f0a7c595154809a9b2ba0e6930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 7 Nov 2015 13:51:09 +0100 Subject: [PATCH 16/67] FIX #3679 Error when deleting a Localtax2 special payment --- htdocs/compta/localtax/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 1b16064ed9e..27990a021cb 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 Marcos García * * 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 @@ -104,7 +105,7 @@ if ($_GET["action"] == 'delete') if ($result > 0) { $db->commit(); - header("Location: ".DOL_URL_ROOT.'/compta/localtax/reglement.php'); + header("Location: ".DOL_URL_ROOT.'/compta/localtax/reglement.php?localTaxType='.$localtax->ltt); exit; } else From 84a152dc2ec2c84350a7214071422ed9b3251712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 7 Nov 2015 15:33:48 +0100 Subject: [PATCH 17/67] FIX #3836 Unable to upload a document to an invoice under some circunstances --- htdocs/core/lib/files.lib.php | 6 +++++- htdocs/core/tpl/document_actions_post_headers.tpl.php | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c92d5ab4f25..b30e0494b39 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2008-2012 Laurent Destailleur * Copyright (C) 2012-2013 Regis Houssin * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2015 Marcos García * * 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 @@ -1041,10 +1042,13 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio // Define $destpath (path to file including filename) and $destfile (only filename) $destpath=$upload_dir . "/" . $_FILES[$varfiles]['name']; $destfile=$_FILES[$varfiles]['name']; + + $savingdocmask = dol_sanitizeFileName($savingdocmask); + if ($savingdocmask) { $destpath=$upload_dir . "/" . preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask); - $destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask); + $destfile=dol_osencode(preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask)); } $resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles); diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 75d18c2b1a5..0e91a3e182d 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2013-2014 Laurent Destailleur + * Copyright (C) 2015 Marcos García * * 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 @@ -48,7 +49,7 @@ if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX)) //var_dump($modulepart); if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','ficheinter','contract','project','project_task'))) { - $savingdocmask=$object->ref.'-__file__'; + $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__'; } /*if (in_array($modulepart,array('member'))) { From 4a52d3c1b1a2ca4df694e222df71b6591676e5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 7 Nov 2015 15:35:00 +0100 Subject: [PATCH 18/67] Removed unwanted change --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index b30e0494b39..7f6737afba2 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1048,7 +1048,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio if ($savingdocmask) { $destpath=$upload_dir . "/" . preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask); - $destfile=dol_osencode(preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask)); + $destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask); } $resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles); From a4fafae1096ec577ebb8e8246bad5a88c05664c5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 7 Nov 2015 17:19:13 +0100 Subject: [PATCH 19/67] FIX : Remove column creation for table llx_product_fournisseur_price, the column use un calss is fk_supplier_price_expression, and fk_price_expression does not exist into lx_product_fournisseur_price sql file declaration --- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 965704f5309..2c0a788e446 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -148,8 +148,6 @@ CREATE TABLE llx_printing userid integer )ENGINE=innodb; -ALTER TABLE llx_product_fournisseur_price ADD COLUMN fk_price_expression integer DEFAULT NULL; - -- Add situation invoices ALTER TABLE llx_facture ADD COLUMN situation_cycle_ref smallint; ALTER TABLE llx_facture ADD COLUMN situation_counter smallint; From f0a3bca4c205b00d36336063b59ba389480494fe Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 8 Nov 2015 04:22:49 +0100 Subject: [PATCH 20/67] Fix: Accountancy compatibility with subtotal & jalon module --- htdocs/accountancy/customer/card.php | 12 ++++++++---- htdocs/accountancy/customer/list.php | 10 ++++++---- htdocs/accountancy/supplier/card.php | 7 ++++--- htdocs/accountancy/supplier/list.php | 11 ++++++----- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 9eb546ec89d..51190afdc98 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * * 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 @@ -19,7 +19,7 @@ /** * \file htdocs/accountancy/customer/card.php - * \ingroup Accounting Expert + * \ingroup Accountancy * \brief Card customer ventilation */ @@ -84,7 +84,11 @@ if (! empty($id)) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON l.fk_code_ventilation = aa.rowid"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = l.fk_facture"; - $sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id; + $sql .= " WHERE f.fk_statut > 0"; + $sql .= " AND l.rowid = " . $id; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND f.entity = '" . $conf->entity . "'"; + } if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = '" . $conf->entity . "'"; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 8ee5eb41eb5..dcf46fe4a44 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -21,7 +21,7 @@ /** * \file htdocs/accountancy/customer/list.php - * \ingroup Accounting Expert + * \ingroup Accountancy * \brief Ventilation page from customers invoices */ @@ -121,7 +121,7 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { $offset = $limit * $page; -$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation,"; +$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation, l.product_type,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell"; $sql .= " , aa.rowid as aarowid"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; @@ -129,7 +129,9 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_fac $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_sell = aa.account_number"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; -$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0"; +$sql .= " WHERE f.fk_statut > 0"; +$sql. = " AND fk_code_ventilation <= 0"; +$sql. = " AND product_type <= 2"; $sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')"; if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = '" . $conf->entity . "'"; diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index 1acd5829c45..8e5d2135965 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -22,7 +22,7 @@ */ /** * \file htdocs/accountancy/supplier/card.php - * \ingroup Accounting Expert + * \ingroup Accountancy * \brief Card supplier ventilation */ @@ -85,7 +85,8 @@ if ($_GET["id"]) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON l.fk_code_ventilation = aa.rowid"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn "; - $sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id; + $sql .= " WHERE f.fk_statut > 0"; + $sql .= " AND l.rowid = " . $id; if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = '" . $conf->entity . "'"; } diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 656afbd32cc..0ed1e1d6aa2 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent s @@ -21,7 +21,7 @@ /** * \file htdocs/accountancy/supplier/list.php - * \ingroup Accounting Expert + * \ingroup Accountancy * \brief Ventilation page from suppliers invoices */ @@ -124,16 +124,17 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { $offset = $limit * $page; -$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, "; +$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.product_type,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_buy = aa.account_number"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; -$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0"; +$sql .= " WHERE f.fk_statut > 0"; +$sql .= " AND fk_code_ventilation <= 0"; +$sql. = " AND product_type <= 2"; $sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')"; - if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = '" . $conf->entity . "'"; } From 972c364c37f1011b454ae82866cc4d695edb780f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 12:12:28 +0100 Subject: [PATCH 21/67] FIX Add a protection to not make release if ChangeLog was not generated. Prepare package 3.8.2 --- ChangeLog | 56 ++++++++++++++++++++++++++++++++++++++ build/makepack-dolibarr.pl | 22 +++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/ChangeLog b/ChangeLog index b77f8a098a3..4cb0e1ef743 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,62 @@ Upgrading to any other version or any other database system is abolutely require make a Dolibarr upgrade. +***** ChangeLog for 3.8.2 compared to 3.8.1 ***** +FIX: 1/ update_extra() function must not be in "if(!empty(MAIN_DISABLE_CONTACTS_TAB)" test. 2/ Reindented code +FIX: #3240 +FIX: #3541 Bypass authentication when user was created using LDAP +FIX: #3605 deleting a shipping +FIX: #3661 Margin is not selected correctly when adding a product +FIX: #3689 Bug on workflow module +FIX: #3724 Bug: Blank page after cloning proposal if we changed client +FIX: #3726 Better support for PRODUCT_USE_OLD_PATH_FOR_PHOTO +FIX: #3726 Not showing images on product card +FIX: #3757 Can't set amount in a social contribution with some languages +FIX: #3786 Translation of select box. +FIX: #3841 creation of a task completed has not status set to finished by default +FIX: #3878 Storing and deleting files on emailing was done at wrong place +FIX: #3880 +FIX: #3882 +FIX: action not appear before an update because of a lack of line in action ressource +FIX: add tag myuser_job into ODT replacement +FIX: Avoid changing the state to a thirdparty who shouldn't be contacted anymore +FIX: bad calculation for stock value +FIX: Bad parameters +FIX: Bad picto for expense report +FIX: bad property so after creating an event from calendar, filter were lost. +FIX: bad stock valorisation +FIX: better fix to generate a PROV ref after clone +FIX: bug invoice classified in propale next update commonobject class in 3.8 +FIX: Can export a field into task time table with export project profile +FIX: change order date on clone (as everywhere else) +FIX: clone customer order create new order with validate ref and not with PROV +FIX: Contacts are not added to the list with the status "no contact" +FIX: Default thirdparty when cloning invoice was not set. +FIX: double db escape add too quote +FIX: event's data lost on user assign update +FIX: Filter in customer price per product of a thirdparty returned error +FIX: filters on supplier invoices list are not used, search_status instead +FIX: fix HTML into formconfirm box +FIX: IF autocomplete was set on thirdparty list, it was not possible to open list of extrafields. +FIX: If no end date is set on survey, we should be able to vote. +FIX: loss data also if update was cancel by error of ended state with no end date, try a generic patch +FIX: no need to remove file into mail form, the temp dir will be deleted after any sending +FIX: pmp calculation +FIX: Preview pages was not using correct style for ref +FIX: project was not retrieved on invoice creation form +FIX: Revert option WORKFLOW_PROPAL_CAN_CLASSIFIED_BILLED_WITHOUT_INVOICES into option WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED for better compatibility with old versions +FIX: Search status not saved into list +FIX: search_status not used in mergefusiontool +FIX: Show category selector if we have permission to view products or services +FIX: Show product image on getNomUrl() +FIX: skeleton class must use db->order rather than ORDER BY into fetchAll +FIX: Societe::set_parent() function needs societe object to be fetched to update parent +FIX: supplier rights for orderToInvoice +FIX: tag object_total_vat_x need x to be a string with unknown decimal lenght. Now use for x the real vat real with no more decimal (x = 20 or x = 8.5 or x = 5.99, ...) +FIX: The preview of PDF was never refreshed if PDF document was changed +FIX: The thumb of user into top menu was using the image in full size. This make a large download at each page call. We must use the mini thumbs. +FIX: Total in summary was not same than into detail on the referrer page. + ***** ChangeLog for 3.8.1 compared to 3.8.0 ***** FIX: #3521 postgresql migration error FIX: #3524 diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 99ec7b3543a..aafc21bf58a 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -351,6 +351,28 @@ if ($nboftargetok) { print "Go to directory $SOURCE\n"; $olddir=getcwd(); chdir("$SOURCE"); + + # Test that the ChangeLog is ok + $ret=`grep "ChangeLog for $MAJOR.$MINOR\.$BUILD" "$SOURCE/ChangeLog" 2>&1`; + if (! $ret) + { + print "Error: The ChangeLogFile was not updated. Run the following command first:\n"; + if (! $BUILD) + { + print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; + } + else + { + print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; + } + print "\n"; + exit; + } + else + { + print "ChangeLog for $MAJOR.$MINOR\.$BUILD was found into '$SOURCE/ChangeLog'\n"; + } + print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; $ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`; if ($ret =~ /already exists/) From 6b98c50510009d35f6a025c07d3d4defa72d8bd3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 12:16:30 +0100 Subject: [PATCH 22/67] FIX Add a protection to not make release if ChangeLog was not generated. --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 4cb0e1ef743..ebdd392622d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ make a Dolibarr upgrade. ***** ChangeLog for 3.8.2 compared to 3.8.1 ***** +FIX: Add a protection to not make release if ChangeLog was not generated. FIX: 1/ update_extra() function must not be in "if(!empty(MAIN_DISABLE_CONTACTS_TAB)" test. 2/ Reindented code FIX: #3240 FIX: #3541 Bypass authentication when user was created using LDAP From 42ae4e10b3439cb879eac71a4845e790bf704bfa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 12:19:05 +0100 Subject: [PATCH 23/67] Abandon package APS. Was never used. --- build/makepack-dolibarr.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index aafc21bf58a..89e970c8b14 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -22,7 +22,8 @@ $PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr"; $PUBLISHBETARC="ldestailleur\@asso.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files"; -@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages +#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages +@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages %REQUIREMENTPUBLISH=( "SF"=>"git ssh rsync", "ASSO"=>"git ssh rsync" From 98b887edaee094b6ebff2fa90fbd8f35d90b982f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 12:23:40 +0100 Subject: [PATCH 24/67] Update doc to generate ChangeLog --- build/makepack-dolibarr.pl | 2 +- build/makepack-howto.txt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 89e970c8b14..fbae52f9726 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -360,7 +360,7 @@ if ($nboftargetok) { print "Error: The ChangeLogFile was not updated. Run the following command first:\n"; if (! $BUILD) { - print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; + print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; } else { diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index 953e207d28d..2bf516dfe88 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -9,8 +9,8 @@ beta version of Dolibarr, step by step. - Check all files are commited. - Update version/info in ChangeLog. -To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x-1.y-1.0 origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" -To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x.y.z-1 origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git rev-list --boundary x.y..origin/develop | grep ^- | cut -c2- | head -n`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" - Update version number with x.y.z-w in htdocs/filefunc.inc.php - Commit all changes. @@ -31,8 +31,8 @@ complete release of Dolibarr, step by step. - Check all files are commited. - Update version/info in ChangeLog. -To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x-1.y-1.0 origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" -To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x.y.z-1 origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git rev-list --boundary x.y..origin/develop | grep ^- | cut -c2- | head -n`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" - Update version number with x.y.z in htdocs/filefunc.inc.php - Commit all changes. From 7a0206adceb3760f867658bff3a0f78bbcdfb3db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 14:37:50 +0100 Subject: [PATCH 25/67] FIX Missing to set context into workflow actions, so triggers can't know we are creating an invoice from order or an order from a proposal. --- htdocs/commande/class/commande.class.php | 4 ++-- .../interface_20_modWorkflow_WorkflowManager.class.php | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f6f332d462b..5d2907041b2 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1043,7 +1043,7 @@ class Commande extends CommonOrder $this->ref_client = $object->ref_client; $this->note_private = $object->note_private; $this->note_public = $object->note_public; - + $this->origin = $object->element; $this->origin_id = $object->id; @@ -1133,7 +1133,7 @@ class Commande extends CommonOrder { global $mysoc, $conf, $langs; - dol_syslog(get_class($this)."::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG); + dol_syslog(get_class($this)."::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type special_code=$special_code", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index d144f365533..4d3afeb8d92 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -61,6 +61,10 @@ class InterfaceWorkflowManager extends DolibarrTriggers include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $newobject = new Commande($this->db); + $newobject->context['createfrompropal'] = 'createfrompropal'; + $newobject->context['origin'] = $object->element; + $newobject->context['origin_id'] = $object->id; + $ret=$newobject->createFromProposal($object); if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; } return $ret; @@ -76,6 +80,10 @@ class InterfaceWorkflowManager extends DolibarrTriggers include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $newobject = new Facture($this->db); + $newobject->context['createfromorder'] = 'createfromorder'; + $newobject->context['origin'] = $object->element; + $newobject->context['origin_id'] = $object->id; + $ret=$newobject->createFromOrder($object); if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; } return $ret; From c639e820621cfe675cea540f443fc007f3972009 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 12:16:30 +0100 Subject: [PATCH 26/67] FIX Add a protection to not make release if ChangeLog was not generated. Conflicts: ChangeLog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 4d3b8252107..d5926b573ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ You may also experience troubles with Mysql 5.5.41 with error "Lost connection" Upgrading to any other version or database system is abolutely required BEFORE trying to make a Dolibarr upgrade. + ***** ChangeLog for 3.7.2 compared to 3.7.1 ***** FIX [ bug #2855 ] Wrong translation key in localtax report page FIX [ bug #1852 ] JS error when editing a customer order line From 9b8bb114cd1850ceaf198ed840c40beeb1c0ba6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 12:12:28 +0100 Subject: [PATCH 27/67] FIX Add a protection to not make release if ChangeLog was not generated. Prepare package 3.7.2 Conflicts: ChangeLog --- ChangeLog | 102 ++++++++++++++++++++++++++++++------- build/makepack-dolibarr.pl | 22 ++++++++ 2 files changed, 107 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5926b573ce..1248b7b1988 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,24 +10,92 @@ make a Dolibarr upgrade. ***** ChangeLog for 3.7.2 compared to 3.7.1 ***** -FIX [ bug #2855 ] Wrong translation key in localtax report page -FIX [ bug #1852 ] JS error when editing a customer order line -FIX [ bug #2900 ] Courtesy title is not stored in create thirdparty form -FIX [ bug #3055 ] Product image thumbnails were not deleted after deleting the image -FIX [ bug 1634 ] Error deleting a project when it had many linked objects -FIX [ bug 1925 ] "Link to order" option in supplier invoices is not working properly -FIX [ bug #3198 ] Trigger LINECONTRACT_INSERT passes Contrat as $object instead of ContratLigne -FIX: Not showing delivery date on rouget pdf +FIX: #2957 : missing $langs object for trigger +FIX: #2983 Load gravatar avatar images securely over HTTPS +FIX: #3009: Better filtering to prevent SQL injection +FIX: #3091 TotalHT amount in supplier order is bold unlike the rest of Dolibarr +FIX: #3262 Webservice getProductsForCategory() +FIX: #3318 +FIX: [ #3460 ] Selected bank account was not saved when an error happened when trying to create a customer invoice +FIX: #3530 +FIX: #3630 - Wrong balance report when module salaries and donation disabled +FIX: #3679 Error when deleting a Localtax2 special payment +FIX: #3707 Thirdparty bank account page table has a glitch +FIX: #3724 Bug: Blank page after cloning proposal with changed client +FIX: #3836 Unable to upload a document to an invoice under some circunstances +FIX: #3841 creation of a task completed has not status set to finished by default +FIX: Add a protection to not make release if ChangeLog was not generated. +FIX: adjusted test for affecting supplier reference +FIX: Admin fiche inter page do not take good action +FIX: Avoid warning strict mode when hosting server do not have php5_curl installed +FIX: bad calculation for stock value +FIX: Bad condition into invoice export request making reporting too many rows. +FIX: bad stock valorisation +FIX: Bad visualization of suppliers name on Incomes-Expenses mode +FIX: Better management error into the color conversion functions +FIX: [ bug 1634 ] Error deleting a project when it had many linked objects +FIX: [ bug 1925 ] "Link to order" option in supplier invoices is not working properly +FIX: [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask +FIX: [ bug #3211 ] Error about sold to pay (Montant encours) +FIX: [ bug #3321 ] Users with certain permissions were shown a "forbidden access" page even if they had the rights +FIX: [ bug #3358 ] Tasks box does not work with PostgreSQL +FIX: [ bug #3383 ] Company name is overlapped with company direction in PDF models +FIX: [ bug #3426 ] Unable to create an invoice from a contract with extrafields +FIX: [ bug #3431 ] Invoice bank account is not respected +FIX: [ bug #3432 ] Spaces should be removed from IBAN when formatting it +FIX: Can create Proposal on close thridparty #3526 +FIX: change order date on clone (as everywhere else) +FIX: Close #2835 Customer prices of a product shows incorrect history order +FIX: Close #2837 Product list table column header does not match column body +FIX: Close bug #2855 Wrong translation key in localtax report page +FIX: Close bug #2861 Undefined variable $res when migrating from 3.6.2 to 3.7.0 +FIX: Close bug #2891 Category hooks do not work +FIX: Close bug #2900 Courtesy title is not stored in create thirdparty form +FIX: Close bug #2976: "Report" tab is the current tab but it is not marked as selected by the UI +FIX: contact country had wrong display if the country dont have translate +FIX: Display country name instead of country id (display country id makes no sense on vcard files) +FIX: display error on extrafields on ficheinter +FIX: double db escape add too quote +FIX: Email selector contact must not include inactive contact +FIX: End log must use same level then start log. +FIX: error in SQL due to a previous fix +FIX: event's data lost on user assign update +FIX: Export of tags for contact and member +FIX: facturestat bad sql when customer view is limited +FIX: if multicompany enabled, call to undifend method _setCookie instead of setCookie +FIX: If supplier invoice block linked element is display after other block total HT amount is not reset to 0 and sum other block (like customer orders values) +FIX: keep filter by category or by not enough stock if we switch page +FIX: Line break display as a block +FIX: load propal langs for availability traduction +FIX: loss data also if update was cancel by error of ended state with no end date, try a generic patch +FIX: Mass Mailing activity don't display all status +FIX: Missing to set context into workflow actions, so triggers can't know we are creating an invoice from order or an order from a proposal. +FIX: multientity warehouse management +FIX: New adherent from, always redirect on entity +FIX: No check warehouse is provided if module stock is not enabled. +FIX: no need to remove file into mail form, the temp dir will be deleted after any sending +FIX: no projet_task_time id from trigger TASK_TIMESPENT_CREATE FIX: Not showing task extrafields when creating from left menu -FIX [ bug #3288 ] Tasks box is not properly drawn -FIX [ bug #3211 ] Outstading bill amount of a client showed wrong amounts -FIX [ bug #3321 ] Users with certain permissions were shown a "forbidden access" page even if they had the rights -FIX [ bug #3426 ] Unable to create an invoice from a contract with extrafields -FIX [ bug #3431 ] Invoice bank account is not respected -FIX [ bug #3432 ] Spaces should be removed from IBAN when formatting it -FIX [ bug #3358 ] Tasks box does not work with PostgreSQL -FIX [ bug #3383 ] Company name is overlapped with company direction in PDF models -FIX [ bug #3460 ] Bank account is not saved when creating a customer invoice and facing an error message +FIX: only active customer should be return into new invoice creation select list +FIX: Payed invoices are showed as canceled FIX: Bad date filter on customer order +FIX: WAP calculation +FIX: Save of filters into export profiles failed. +FIX: supplier rights for orderToInvoice +FIX: Syntax error in Debian Apache configuration +FIX: The hours of date filter aren't correct +FIX: tool export handle the type "select" extrafields and return the value instead of id +FIX: total amount in tpl linked object are not reset +FIX: translate Jabberid on contact page with edit view +FIX: translation for 1 word do not work if product/service module are disabled because the translation search in products.lang +FIX: update2.php test res befre assign it +FIX: When delete actioncomm also delete actioncomm_resources +FIX: when fetch_optionnal_by_label in Extrafields with $this->db cannot work because this->db is never instanciated +FIX: when mailing is deleted, the targets list was kept in database +FIX: when multicompany was enabled, this function didn't check just on the good entity (problem when both company use same mask) +FIX: When we add an user on event in create mode, we lose linked object +FIX: When we automatically creta an order from a proposal with workflow module, if some extrafields of propal don't exist in order object, insertExtraFields() function tries to insert extrafields in unexistant column of commande_extrafields table. +FIX: When we clone a propal, if it has a project which is not assigned to a third, it was not on new propal because fk_project was always set to empty string if new propal is for another third. +FIX: XSS security using the onerror and missing escapement on type of member page. NEW: Created new ContratLigne::insert function diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 18e7092fc1b..d37c6b891aa 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -344,6 +344,28 @@ if ($nboftargetok) { print "Go to directory $SOURCE\n"; $olddir=getcwd(); chdir("$SOURCE"); + + # Test that the ChangeLog is ok + $ret=`grep "ChangeLog for $MAJOR.$MINOR\.$BUILD" "$SOURCE/ChangeLog" 2>&1`; + if (! $ret) + { + print "Error: The ChangeLogFile was not updated. Run the following command first:\n"; + if (! $BUILD) + { + print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; + } + else + { + print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; + } + print "\n"; + exit; + } + else + { + print "ChangeLog for $MAJOR.$MINOR\.$BUILD was found into '$SOURCE/ChangeLog'\n"; + } + print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; $ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`; if ($ret =~ /already exists/) From 04aba8ce96807bf7856d263379fc911227e7660f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 12:19:05 +0100 Subject: [PATCH 28/67] Abandon package APS. Was never used. --- build/makepack-dolibarr.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index d37c6b891aa..a47fb76d35c 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -22,7 +22,8 @@ $PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr"; $PUBLISHBETARC="ldestailleur\@asso.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files"; -@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages +#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages +@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages %REQUIREMENTPUBLISH=( "SF"=>"git ssh rsync", "ASSO"=>"git ssh rsync" From d4aeb8b3bcea0e212de82f2ade1070f56a262088 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 12:19:05 +0100 Subject: [PATCH 29/67] Abandon package APS. Was never used. --- build/makepack-dolibarr.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 9db6f3a4da3..c2359241ad0 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -22,7 +22,8 @@ $PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr"; $PUBLISHBETARC="ldestailleur\@asso.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files"; -@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages +#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages +@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages %REQUIREMENTPUBLISH=( "SF"=>"git ssh rsync", "ASSO"=>"git ssh rsync" From 722a133b314807bd08b9a0d59c0614f6b0599d7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 12:12:28 +0100 Subject: [PATCH 30/67] FIX Add a protection to not make release if ChangeLog was not generated. Prepare package 3.6.5 Conflicts: ChangeLog Conflicts: ChangeLog --- ChangeLog | 38 ++++++++++++++++++++++++++++++++++++-- build/makepack-dolibarr.pl | 22 ++++++++++++++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a59cf9b7006..bd64723725a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,9 +2,43 @@ English Dolibarr ChangeLog -------------------------------------------------------------- + ***** ChangeLog for 3.6.5 compared to 3.6.4 ***** -- Fix: [ bug #1776 ] Undefined $deliverycompany variable in pdf_build_address -- Fix: [ bug #1794 ] Error when cloning Proposal gives error in a malformed page +FIX: #2957 : missing $langs object for trigger +FIX: #2983 Load gravatar avatar images securely over HTTPS +FIX: #3009: Better filtering to prevent SQL injection +FIX: #3841 creation of a task completed has not status set to finished by default +FIX: #3890 Expected transactions bank account page, shows negative numbers +FIX: #3928 Creating a Customer order and a Customer invoice from a project, does not inherit payment conditions and method of payment of customer card +FIX: bad calculation for stock value +FIX: bad stock valo +FIX: bad stock valorisation +FIX: [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask +FIX: button create payment hide if tax amount is less than 1 +FIX: change object statut on close shipping and remove erratic db commit +FIX: change order date on clone (as everywhere else) +FIX: Close #2835 Customer prices of a product shows incorrect history order +FIX: Close #2837 Product list table column header does not match column body +FIX: Close bug #2861 Undefined variable $res when migrating from 3.6.2 to 3.7.0 +FIX: Close bug #2891 Category hooks do not work +FIX: Close bug #2976: "Report" tab is the current tab but it is not marked as selected by the UI +FIX: contact country had wrong display if the country dont have translate +FIX: double db escape add too quote +FIX: End log must use same level then start log. +FIX: error in SQL due to a previous fix +FIX: event for restricted user was restricted if company null +FIX: facturestat bad sql when customer view is limited +FIX: If supplier invoice block linked element is display after other block total HT amount is not reset to 0 and sum other block (like customer orders values) +FIX: keep filter by category or by not enough stock if we switch page +FIX: no need to remove file into mail form, the temp dir will be deleted after any sending +FIX: no projet_task_time id from trigger TASK_TIMESPENT_CREATE +FIX: pmp +FIX: send mail, copy sendto don't read the list of contact +FIX: The hours of date filter aren't correct +FIX: tool export handle the type "select" extrafields and return the value instead of id +FIX: top links menu have target attribute with wrong value +FIX: total amount in tpl linked object are not reset +FIX: when multicompany was enabled, this function didn't check just on the good entity (problem when both company use same mask) ***** ChangeLog for 3.6.4 compared to 3.6.3 ***** - Fix: [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index c2359241ad0..603fd0f2e7a 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -345,6 +345,28 @@ if ($nboftargetok) { print "Go to directory $SOURCE\n"; $olddir=getcwd(); chdir("$SOURCE"); + + # Test that the ChangeLog is ok + $ret=`grep "ChangeLog for $MAJOR.$MINOR\.$BUILD" "$SOURCE/ChangeLog" 2>&1`; + if (! $ret) + { + print "Error: The ChangeLogFile was not updated. Run the following command first:\n"; + if (! $BUILD) + { + print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; + } + else + { + print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; + } + print "\n"; + exit; + } + else + { + print "ChangeLog for $MAJOR.$MINOR\.$BUILD was found into '$SOURCE/ChangeLog'\n"; + } + print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; $ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`; if ($ret =~ /already exists/) From 350345eccaa70ac932f7ddaa94e6f217f01bef6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 15:18:26 +0100 Subject: [PATCH 31/67] Prepare 3.6.5 --- build/debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/debian/changelog b/build/debian/changelog index 17fdd65230e..5d34808d3a6 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -1,4 +1,4 @@ -dolibarr (3.6.4-3) UNRELEASED; urgency=low +dolibarr (3.6.5-3) UNRELEASED; urgency=low [ Laurent Destailleur (eldy) ] * New upstream release. From 71fa347e8e0a5f3bfbf7f76b0bbeb826d3a1b771 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2015 18:40:12 +0100 Subject: [PATCH 32/67] FIX Better compatibility for users that used the not supported option MAIN_USE_JQUERY_MULTISELECT set to 1. --- htdocs/core/class/conf.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 63b07830f40..c3e525cd2ab 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -449,7 +449,7 @@ class Conf if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,askpricesupplier,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later. // Enable select2 - if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT)) $this->global->MAIN_USE_JQUERY_MULTISELECT='select2'; + if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT) || $this->global->MAIN_USE_JQUERY_MULTISELECT == '1') $this->global->MAIN_USE_JQUERY_MULTISELECT='select2'; // Timeouts if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10; From 98c32fa1ec8184dc84fd868210516f5a0dbd96c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Nov 2015 00:36:33 +0100 Subject: [PATCH 33/67] FIX The label hidden was not supported when using jmobile --- htdocs/core/tpl/login.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index c0af2a25b74..412554345ef 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -93,7 +93,7 @@ $(document).ready(function () { - +global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> " name="username" class="flat input-icon-user" size="20" value="" tabindex="1" autofocus="autofocus" /> @@ -102,7 +102,7 @@ $(document).ready(function () { - +global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> " name="password" class="flat input-icon-password" type="password" size="20" value="" tabindex="2" autocomplete="off" /> From b0419557b16e756eb2e4555b335b4c82da17efe9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Nov 2015 00:37:04 +0100 Subject: [PATCH 34/67] Exclude dir --- htdocs/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/.gitignore b/htdocs/.gitignore index 949cb7c77f5..0fc62ed06f7 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -15,3 +15,4 @@ /dolimed* /allscreens* /ecommerce/ +/cabinetmed* From f041c017e997602e98a0308eb86d178068645bcf Mon Sep 17 00:00:00 2001 From: phf Date: Thu, 12 Nov 2015 11:30:44 +0100 Subject: [PATCH 35/67] FIX mail isn't display in title on event in mode view --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index a888cf5566e..5b013e7a57c 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1173,7 +1173,7 @@ if ($id > 0) } // Title - print ''.$langs->trans("Title").''.$object->label.''; + print ''.$langs->trans("Title").''.dol_htmlentities($object->label).''; // Full day event print ''.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).''; From aaa6f00d1186201729964ffca2b0dbcb109a4e46 Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 12 Nov 2015 12:31:51 +0100 Subject: [PATCH 36/67] FIX export propal and order with extrafields --- htdocs/core/modules/modCommande.class.php | 38 ++++++++++++++++++++++- htdocs/core/modules/modPropale.class.php | 38 ++++++++++++++++++++++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index da2f7d794ed..eabf8e17160 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -182,7 +182,43 @@ class modCommande extends DolibarrModules $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.label'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - + // Add extra fields + $sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande' AND entity IN (0, ".$conf->entity.')'; + $resql=$this->db->query($sql); + if ($resql) // This can fail when class is used on old database (during migration for example) + { + while ($obj=$this->db->fetch_object($resql)) + { + $fieldname='extra.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $typeFilter="Text"; + switch($obj->type) + { + case 'int': + case 'double': + case 'price': + $typeFilter="Numeric"; + break; + case 'date': + case 'datetime': + $typeFilter="Date"; + break; + case 'boolean': + $typeFilter="Boolean"; + break; + case 'sellist': + $tmp=''; + $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null + if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options'])); + if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; + break; + } + $this->export_fields_array[$r][$fieldname]=$fieldlabel; + $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; + $this->export_entities_array[$r][$fieldname]='order'; + } + } + // End add extra fields $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index cb297f87a61..8a14e85b578 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -175,7 +175,43 @@ class modPropale extends DolibarrModules $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.ref'=>'Text','p.label'=>'Text'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note_public'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - + // Add extra fields + $sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'propal' AND entity IN (0, ".$conf->entity.')'; + $resql=$this->db->query($sql); + if ($resql) // This can fail when class is used on old database (during migration for example) + { + while ($obj=$this->db->fetch_object($resql)) + { + $fieldname='extra.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $typeFilter="Text"; + switch($obj->type) + { + case 'int': + case 'double': + case 'price': + $typeFilter="Numeric"; + break; + case 'date': + case 'datetime': + $typeFilter="Date"; + break; + case 'boolean': + $typeFilter="Boolean"; + break; + case 'sellist': + $tmp=''; + $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null + if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options'])); + if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; + break; + } + $this->export_fields_array[$r][$fieldname]=$fieldlabel; + $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; + $this->export_entities_array[$r][$fieldname]='propal'; + } + } + // End add extra fields $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s '; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; From 019575d9edf05b0a2e7672b6534f54845458832e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 12 Nov 2015 13:21:35 +0100 Subject: [PATCH 37/67] FIX : better fix for #3805 --- htdocs/compta/facture/class/facture.class.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6a807ffca75..6f8484cbc42 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3677,22 +3677,22 @@ class Facture extends CommonInvoice */ function is_last_in_cycle() { - if (empty($this->situation_cycle_ref)) { + 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); - - if ($resql && $resql->num_rows > 0) { - $res = $this->db->fetch_array($resql); - $last = $res['max(situation_counter)']; - return ($last == $this->situation_counter); + $sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref; + $resql = $this->db->query($sql); + + if ($resql && $resql->num_rows > 0) { + $res = $this->db->fetch_array($resql); + $last = $res['max(situation_counter)']; + return ($last == $this->situation_counter); + } else { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR); + return false; + } } else { - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR); - return false; + return true; } } From 52bd90f950c8b684a9af8d66325edbd39bb2773a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 12 Nov 2015 14:12:56 +0100 Subject: [PATCH 38/67] Fix: wrong var name --- htdocs/fichinter/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 56287721180..033db575c4d 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -119,7 +119,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->fichein $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; @@ -145,7 +145,7 @@ else if ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->fich $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->model:GETPOST('model','apha'), $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; From 9a9be97c2cb5939b1687cb7867cc0c0a6081fefd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2015 14:36:35 +0100 Subject: [PATCH 39/67] Add a log to help diagnose bad usage of method ad of event --- htdocs/comm/action/class/actioncomm.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index aa7d532025e..7c53a885043 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -196,6 +196,7 @@ class ActionComm extends CommonObject // Check parameters if (empty($this->userownerid)) { + dol_syslog("You tried to create an event but mandatory property ownerid was not defined", LOG_WARNING); $this->errors[]='ErrorPropertyUserowneridNotDefined'; return -1; } From 682842f15fe3074e37ea967ecf5c89f6f79e6205 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2015 10:37:51 +0100 Subject: [PATCH 40/67] Fix into title of login page, we must report the tru dolibarr version after the @ (technical information), event if application name/version was replaced with a constant. --- htdocs/core/lib/security2.lib.php | 4 +++- htdocs/core/tpl/login.tpl.php | 2 +- htdocs/main.inc.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 0d94357a201..a32805b6169 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -148,8 +148,10 @@ function dol_loginfunction($langs,$conf,$mysoc) if (! preg_match('/mainmenu=/',$php_self)) $php_self.=(preg_match('/\?/',$php_self)?'&':'?').'mainmenu=home'; // Title - $title='Dolibarr '.DOL_VERSION; + $appli=constant('DOL_APPLICATION_TITLE'); + $title=$appli.' '.DOL_VERSION; if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE; + $titletruedolibarrversion=DOL_VERSION; // $title used by login template after the @ to inform of true Dolibarr version // Note: $conf->css looks like '/theme/eldy/style.css.php' $conf->css = "/theme/".(GETPOST('theme')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php"; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index c0af2a25b74..7bfb576b1c4 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -33,7 +33,7 @@ $arrayofjs=array( '/includes/jstz/jstz.min.js'.(empty($conf->dol_use_jmobile)?'':'?version='.urlencode(DOL_VERSION)), '/core/js/dst.js'.(empty($conf->dol_use_jmobile)?'':'?version='.urlencode(DOL_VERSION)) ); -$titleofloginpage=$langs->trans('Login').' @ '.$title; // title is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page. +$titleofloginpage=$langs->trans('Login').' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version. print top_htmlhead('',$titleofloginpage,0,0,$arrayofjs); ?> diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index eb2aa212e7c..b629b265012 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1447,7 +1447,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a else $appli.=" ".DOL_VERSION; } else $appli.=" ".DOL_VERSION; - if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $appli.="
".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; + + if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $appli.="
".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; $logouttext=''; $logouthtmltext=$appli.'
'; From b3be7f65cd1edd8fd99c652fa8bc53125f9c42d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2015 11:12:49 +0100 Subject: [PATCH 41/67] Fix syntax error . = instead of .= --- htdocs/accountancy/customer/list.php | 4 ++-- htdocs/accountancy/supplier/list.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index dcf46fe4a44..e36f2e480ea 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -130,8 +130,8 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_sell = aa.account_number"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; $sql .= " WHERE f.fk_statut > 0"; -$sql. = " AND fk_code_ventilation <= 0"; -$sql. = " AND product_type <= 2"; +$sql .= " AND fk_code_ventilation <= 0"; +$sql .= " AND product_type <= 2"; $sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')"; if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = '" . $conf->entity . "'"; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 0ed1e1d6aa2..4a592c1a3ca 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -133,7 +133,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountan $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; $sql .= " WHERE f.fk_statut > 0"; $sql .= " AND fk_code_ventilation <= 0"; -$sql. = " AND product_type <= 2"; +$sql .= " AND product_type <= 2"; $sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')"; if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = '" . $conf->entity . "'"; From c59482fea12aacd9a15f6f0fa7699137f99b3c2c Mon Sep 17 00:00:00 2001 From: All-3kcis Date: Fri, 13 Nov 2015 11:17:23 +0100 Subject: [PATCH 42/67] Fix #3542 --- htdocs/core/login/functions_ldap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 208ccd0c37c..71b93f8ee82 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -138,7 +138,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest) $ldap->searchUser=$ldapuserattr."=".$usertotest.",".$ldapdn; // Default dn (will work if LDAP accept a dn with login value inside) // But if LDAP need a dn with name like "cn=Jhon Bloggs,ou=People,dc=foo,dc=com", previous part must have been executed to have // dn detected into ldapUserDN. - if ($resultFetchLdapUser) $ldap->searchUser = $ldap->ldapUserDN; + if ($resultFetchLdapUser AND !empty($ldap->ldapUserDN)) $ldap->searchUser = $ldap->ldapUserDN; $ldap->searchPassword=$passwordtotest; // Test with this->seachUser and this->searchPassword From bad28c6d921949da1ff7772a076d56999942e419 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2015 11:44:55 +0100 Subject: [PATCH 43/67] Fi sntax error --- htdocs/commande/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 5514e34c7e6..113a976a997 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1264,7 +1264,8 @@ if ($action == 'create' && $user->rights->commande->creer) { } if (!$dateorder) { // Do not set 0 here (0 for a date is 1970) - $dateorder = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE_ODER)?-1:''):$dateorder); + $dateorder = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE_ODER)?-1:''):$dateorder); + } } else { // For compatibility if ($element == 'order' || $element == 'commande') { From 965de406d30193ead4e4b7efb5f29ecb69edfbf8 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 13 Nov 2015 11:47:15 +0100 Subject: [PATCH 44/67] FIX htmlname parameters wasnt applied --- htdocs/core/ajax/contacts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/ajax/contacts.php b/htdocs/core/ajax/contacts.php index 97f29c4069d..c0cd9ecfd70 100644 --- a/htdocs/core/ajax/contacts.php +++ b/htdocs/core/ajax/contacts.php @@ -50,7 +50,7 @@ if (! empty($id) && ! empty($action) && ! empty($htmlname)) $return=array(); if (empty($showempty)) $showempty=0; - $return['value'] = $form->selectcontacts($id,'','contactid',$showempty,'','',0,'',true); + $return['value'] = $form->selectcontacts($id,'',$htmlname,$showempty,'','',0,'',true); $return['num'] = $form->num; $return['error'] = $form->error; From 5e67eefff36d846277f1ae8fe24d963c8142699b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2015 12:48:17 +0100 Subject: [PATCH 45/67] Removed phpcs warning --- htdocs/core/lib/pdf.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 881415555bc..c29d9c5a04d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -173,7 +173,7 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P') * This class is an enhanced FPDI class that support method writeHTMLCell */ class FPDI_DolExtended extends FPDI - { + { /** * __call * @@ -726,7 +726,8 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $ibanDisplay_temp = str_replace(' ', '', $outputlangs->convToOutputCharset($account->iban)); $ibanDisplay = ""; - for($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++) + $nbIbanDisplay_temp = dol_strlen($ibanDisplay_temp); + for ($i = 0; $i < $nbIbanDisplay_temp; $i++) { $ibanDisplay .= $ibanDisplay_temp[$i]; if($i%4 == 3 && $i > 0) $ibanDisplay .= " "; From 8068d01cfcf68985ac73e47531065577f96316ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2015 14:16:45 +0100 Subject: [PATCH 46/67] Add style maxwidth150 --- htdocs/theme/eldy/style.css.php | 1 + htdocs/theme/md/style.css.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 59461c1db87..34a27edf3b7 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -508,6 +508,7 @@ div.confirmmessage { .minwidth200 { min-width: 200px; } .minwidth300 { min-width: 300px; } .maxwidth100 { max-width: 100px; } +.maxwidth150 { max-width: 150px; } .maxwidth200 { max-width: 200px; } .maxwidth300 { max-width: 300px; } .titlefield { width: 30%; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 45a4f755a05..dbc808e8254 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -497,6 +497,7 @@ div.confirmmessage { .minwidth200 { min-width: 200px; } .minwidth300 { min-width: 300px; } .maxwidth100 { max-width: 100px; } +.maxwidth150 { max-width: 150px; } .maxwidth200 { max-width: 200px; } .maxwidth300 { max-width: 300px; } .titlefield { width: 30%; } From 88356e2e97e17110ffd8a6fab4b72886355c6bbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2015 14:24:02 +0100 Subject: [PATCH 47/67] Add a new rule on contributing when adding a new table. --- CONTRIBUTING.md | 17 ++++++++++------- README.md | 4 ++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a39f6b84a59..ab328c8e785 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ How to contribute to Dolibarr Bug reports and feature requests -------------------------------- -*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum). +*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum). Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/Issues). @@ -13,9 +13,9 @@ Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/Issues). 4. Tell us the version you are using! 3. Write a report with as much detail as possible (Use [screenshots](https://help.github.com/articles/issue-attachments) or even screencasts and provide logging and debugging informations whenever possible). -We're still figuring out how to migrate old issues to GitHub. In the meantime, they are still available at [Doliforge](https://doliforge.org/projects/dolibarr). -Code + +Code --------------------- ### Basic workflow @@ -26,7 +26,7 @@ We're still figuring out how to migrate old issues to GitHub. In the meantime, t 4. Commit and push your changes. 5. [Make a pull request](https://help.github.com/articles/creating-a-pull-request). -### Branches +### Branches Unless you're fixing a bug, all pull requests should be made against the *develop* branch. @@ -40,7 +40,7 @@ Choose your base branch accordingly. ### General rules Please don't edit the ChangeLog file. File will be generated from your commit messages during release process by the project manager. -### Commits +### Commits Use clear commit messages with the following structure: ``` @@ -98,8 +98,11 @@ If your pull request only contains one commit, GitHub will be smart enough to fi Otherwise, please be a bit verbose about what you're providing. Your Pull Request must pass the Continuous Integration checks. -Also, if you want to include a new external library (into htdocs/includes directory), please ask before to the project -leader to see if such a library can be accepted. +Also, some code changes need a prior approbation: + +* if you want to include a new external library (into htdocs/includes directory), please ask before to the project leader to see if such a library can be accepted. + +* if you add a new table, you must first create a page on http://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Than ask the project leader if the new data model you plan to add can be accepted as you suggest. ### Resources [Developer documentation](http://wiki.dolibarr.org/index.php/Developer_documentation) diff --git a/README.md b/README.md index 91f99dc8025..0c3507f62f6 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,10 @@ These are features that Dolibarr does **not** yet fully support: Administrator, user, developer and translator's documentations are available along with other community resources on the [Wiki](http://wiki.dolibarr.org). +## CONTRIBUTING + +See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/CONTRIBUTING.md) + ## CREDITS Dolibarr is the work of many contributors over the years and uses some fine libraries. From 298a67134241ea6fe9f20cd4d2cf86238256e410 Mon Sep 17 00:00:00 2001 From: Paris Liakos Date: Fri, 13 Nov 2015 20:25:12 +0200 Subject: [PATCH 48/67] getListOfProductsOrServices() filters are broken --- htdocs/webservices/server_productorservice.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 9d26ce52fb2..2e3314fff12 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -946,9 +946,9 @@ function getListOfProductsOrServices($authentication,$filterproduct) $sql.=" WHERE entity=".$conf->entity; foreach($filterproduct as $key => $val) { - if ($key == 'type' && $val >= 0) $sql.=" AND fk_product_type = ".$db->escape($val); - if ($key == 'tosell') $sql.=" AND to_sell = ".$db->escape($val); - if ($key == 'tobuy') $sql.=" AND to_buy = ".$db->escape($val); + if ($key == 'type' && $val >= 0) $sql.=" AND fk_product_type = ".$db->escape($val); + if ($key == 'status_tosell') $sql.=" AND tosell = ".$db->escape($val); + if ($key == 'status_tobuy') $sql.=" AND tobuy = ".$db->escape($val); } $resql=$db->query($sql); if ($resql) From 488acfd1772df96542cd8e801c172a604839d877 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sat, 14 Nov 2015 10:50:26 +0100 Subject: [PATCH 49/67] Add statut2 icon and adjust some other --- htdocs/theme/eldy/img/statut1.png | Bin 190 -> 201 bytes htdocs/theme/eldy/img/statut2.png | Bin 0 -> 221 bytes htdocs/theme/eldy/img/statut4.png | Bin 190 -> 183 bytes htdocs/theme/eldy/img/statut6.png | Bin 212 -> 231 bytes htdocs/theme/eldy/img/statut9.png | Bin 203 -> 201 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 htdocs/theme/eldy/img/statut2.png diff --git a/htdocs/theme/eldy/img/statut1.png b/htdocs/theme/eldy/img/statut1.png index 558439d282e451c5f0750dfb474e8c83d55fb6ee..88f3b3c53a0f778be1d756b37a020cbdb4eeb494 100644 GIT binary patch delta 185 zcmdnTc#?5~L_G%+0|UcN@zWcC6kC$Fy9>jA5L~c#`DCC7XMsm#F#`j)FbFd;%$g$s z6l5>)^mS#w&&|gvZ15q3<0Mc>F*78h#5q4VH#M&W$Yo$~E=o--Nlj5G&n(GM2+2rQ zaQE~L$lWjk-YQ#um*w YSBCIR_Fi6>XibndPgg&ebxsLQ07$erH~;_u delta 155 zcmX@fxQ}sygaZ>Z0|SG$^p+AJ#aZAHSN$EvSM2%b2%s#3r>mdKI;Vst03qxy ALjV8( diff --git a/htdocs/theme/eldy/img/statut2.png b/htdocs/theme/eldy/img/statut2.png new file mode 100644 index 0000000000000000000000000000000000000000..ad5a7084474ac59240cd827b61e0dc4f03a521cc GIT binary patch literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1SD^YpWXnZI14-?iy0WWg+Z8+Vb&Z8pdfpR zr>`sfeQrKZNyFMb7p?+@6f;92N}Tg^b5rw5fLsO!=c3falGGH1^30M9g^-L?1$R&1 zfZPq!L2~|{E{-7*my=`mBr-B99yoO1z=P!FE$&CBIe(w=VRqq@hwf}_Y-&wfA2gd* zA6Ur|$y(-`p|wHdP)OrCj@4Wut~){$L>>k*@_y89fA^3-h@sy>Zl&A5MkkQjp00i_ I>zopr0K@`B0ssI2 literal 0 HcmV?d00001 diff --git a/htdocs/theme/eldy/img/statut4.png b/htdocs/theme/eldy/img/statut4.png index 6ec1ba559613fc19c80ae08681f3b47459cfd0bd..6dc05edeba79c3f792ea8554dae3608368360be9 100644 GIT binary patch delta 167 zcmdnTxSer=L_G%+0|UcN@zWcC6lZ})WHAE+w=f7ZGR&GI0Tg5}@$_|Nzt7Fbsckt= zoM#$PNHH@cqQp5rH#aq}1juDza4t$sEJ;mKD9Eak7 zaXHy%{+x3T92*P_41V1B@gQ*H(-UH9Y)T3TRwz9Z+30XcWWN%FnLXReDy3J)K-xTA L{an^LB{Ts5j<+&% delta 174 zcmdnaxQ}syL_HHT0|SG$^p+AJ#aZAHSwc6hbmm72G|21Ky{o=79_h@Ck8E zpPat={O14v|F4miO$G`wCV9KNFr{(VqyRbULY^*;Asp9}6Bw8-UJzJhAi%(|{uX<# T*z?U1Kxqa~S3j3^P6et= diff --git a/htdocs/theme/eldy/img/statut6.png b/htdocs/theme/eldy/img/statut6.png index b964afff603903135c2e897900f1dddf3ffaf779..c76ab86fe601499d63e768104752c7ed1e4319ca 100644 GIT binary patch delta 215 zcmcb@_?&TqL_G%+0|UcN@zWcC6lZ})WHAE+w=f7ZGR&GI0Tg5}@$_|Nzt7FbsUues zqi+QiQp^mAC~?lu%}vcK0dg4_oQqNuOHxx5$}>wc6hbmm72G|219CS^2gyZxx;TbN zTu%0xKj)kS#|8%td1?7Im!kV}5)%>3`QbqZz=ZwzQz#uv$Y$T#EF zg*hjVIItufDq&ytd&Y)cBEGW1Vbd3_Om1nh_;(=1@!12Q!`B<#|I;*q3uKL_tDnm{ Hr-UW|2(3pA delta 196 zcmaFPc!hC-L_HHT0|SG$^p+AJ#aZAHSjA5L~c#`DCC7XMsm#F#`j)FbFd;%$g$s z6l5>)^mS#w&&|ilt{mku&j~1`m>CjL;+&tGo0?YwD zxO@5ra%G8Ki@xY-22NE(fJKc|de0+SSL7({ delta 168 zcmX@fc$#s7gf9~_0|SG$^p+AJ#aJBV?!>U}oXkrghqJ&VvY3H^_c{Xu-w{T|#+1!K zLG}_)Usv|q%p%-u#wRtesse>%OI#yLobz*YQ}aqD=7|NoPf^VSX%FxTab3N7^^+%0 z{{R0UXYJ?-6l6^Dc6VV)zopr0EGN91ONa4 From 01058be44ca14b43583c5aef761d820ef68b5c64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Nov 2015 15:28:25 +0100 Subject: [PATCH 50/67] NEW Introduce a "code" into fiels to describe vat. This will allow to suggest different vat lines with same value with ability to differentiate them. --- htdocs/admin/dict.php | 22 +-- .../class/askpricesupplier.class.php | 6 +- htdocs/comm/propal/class/propal.class.php | 6 +- htdocs/commande/class/commande.class.php | 6 +- htdocs/compta/facture.php | 8 +- htdocs/compta/facture/class/facture.class.php | 8 +- htdocs/contrat/class/contrat.class.php | 6 +- htdocs/core/class/html.form.class.php | 17 +- htdocs/core/lib/functions.lib.php | 173 +++++++++++------- htdocs/core/tpl/objectline_create.tpl.php | 2 +- htdocs/core/tpl/objectline_edit.tpl.php | 2 +- .../class/fournisseur.commande.class.php | 6 +- .../fourn/class/fournisseur.facture.class.php | 3 +- .../install/mysql/migration/3.8.0-3.9.0.sql | 4 +- htdocs/install/mysql/tables/llx_c_tva.key.sql | 6 +- htdocs/install/mysql/tables/llx_c_tva.sql | 1 + 16 files changed, 167 insertions(+), 109 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7022c5877eb..099c41f4685 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -150,7 +150,7 @@ $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.t $tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid"; $tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; -$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; +$tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; $tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.fdm, c.decalage, c.active, c.sortorder FROM ".MAIN_DB_PREFIX.'c_payment_term AS c'; $tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.accountancy_code FROM ".MAIN_DB_PREFIX."c_paiement AS c"; @@ -182,7 +182,7 @@ $tabsqlsort[6] ="a.type ASC, a.module ASC, a.position ASC, a.code ASC"; $tabsqlsort[7] ="country ASC, code ASC, a.libelle ASC"; $tabsqlsort[8] ="country DESC, libelle ASC"; $tabsqlsort[9] ="label ASC"; -$tabsqlsort[10]="country ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC"; +$tabsqlsort[10]="country ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC"; $tabsqlsort[11]="element ASC, source ASC, code ASC"; $tabsqlsort[12]="sortorder ASC, code ASC"; $tabsqlsort[13]="code ASC"; @@ -214,7 +214,7 @@ $tabfield[6] = "code,libelle,type,color,position"; $tabfield[7] = "code,libelle,country,accountancy_code,deductible"; $tabfield[8] = "code,libelle,country_id,country"; $tabfield[9] = "code,label,unicode"; -$tabfield[10]= "country_id,country,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; +$tabfield[10]= "country_id,country,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[11]= "element,source,code,libelle"; $tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage,sortorder"; $tabfield[13]= "code,libelle,type,accountancy_code"; @@ -246,7 +246,7 @@ $tabfieldvalue[6] = "code,libelle,type,color,position"; $tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible"; $tabfieldvalue[8] = "code,libelle,country"; $tabfieldvalue[9] = "code,label,unicode"; -$tabfieldvalue[10]= "country,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; +$tabfieldvalue[10]= "country,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[11]= "element,source,code,libelle"; $tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage,sortorder"; $tabfieldvalue[13]= "code,libelle,type,accountancy_code"; @@ -278,7 +278,7 @@ $tabfieldinsert[6] = "code,libelle,type,color,position"; $tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible"; $tabfieldinsert[8] = "code,libelle,fk_country"; $tabfieldinsert[9] = "code_iso,label,unicode"; -$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; +$tabfieldinsert[10]= "fk_pays,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[11]= "element,source,code,libelle"; $tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage,sortorder"; $tabfieldinsert[13]= "code,libelle,type,accountancy_code"; @@ -376,7 +376,7 @@ $tabhelp[6] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs-> $tabhelp[7] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[8] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[9] = array('code'=>$langs->trans("EnterAnyCode"), 'unicode'=>$langs->trans("UnicodeCurrency")); -$tabhelp[10] = array('taux'=>$langs->trans("SellTaxRate"), 'recuperableonly'=>$langs->trans("RecuperableOnly"), 'localtax1_type'=>$langs->trans("LocalTaxDesc"), 'localtax2_type'=>$langs->trans("LocalTaxDesc")); +$tabhelp[10] = array('code'=>$langs->trans("EnterAnyCode"), 'taux'=>$langs->trans("SellTaxRate"), 'recuperableonly'=>$langs->trans("RecuperableOnly"), 'localtax1_type'=>$langs->trans("LocalTaxDesc"), 'localtax2_type'=>$langs->trans("LocalTaxDesc")); $tabhelp[11] = array(); $tabhelp[12] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[13] = array('code'=>$langs->trans("EnterAnyCode")); @@ -522,8 +522,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $ok=1; foreach ($listfield as $f => $value) { - if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory - if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory + if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory + if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; if ($value == 'color' && empty($_POST['color'])) continue; @@ -1321,7 +1321,7 @@ if ($id) // Can an entry be erased or disabled ? $iserasable=1;$isdisable=1; // true by default - if (isset($obj->code)) + if (isset($obj->code) && $id != 10) { if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $isdisable = 0; } else if ($obj->code == 'RECEP') { $iserasable = 0; $isdisable = 0; } @@ -1356,7 +1356,7 @@ if ($id) print ""; // Modify link - if ($iserasable) print ''.img_edit().''; + if ($iserasable) print ''.img_edit().''; else print ' '; // Delete link @@ -1479,7 +1479,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } // For state page, we do not show the country input (we link to region, not country) print ''; $fieldname='country'; - print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28); + print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth300'); print ''; } elseif ($fieldlist[$field] == 'country_id') diff --git a/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php b/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php index 2f563a17b1b..1cb2e72f292 100644 --- a/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php +++ b/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php @@ -369,7 +369,8 @@ class AskPriceSupplier extends CommonObject // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); - + $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -528,7 +529,8 @@ class AskPriceSupplier extends CommonObject // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); - + $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index fcac4ba9de1..fd3964406c5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -439,7 +439,8 @@ class Propal extends CommonObject // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); - + $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; @@ -600,7 +601,8 @@ class Propal extends CommonObject // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); - + $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 922e695339a..fa195680a36 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1220,7 +1220,8 @@ class Commande extends CommonOrder // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); - + $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type,'', $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -2442,7 +2443,8 @@ class Commande extends CommonOrder // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); - + $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index af3d600756e..0a453db92db 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1401,12 +1401,12 @@ if (empty($reshook)) // Margin $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); - $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we muste keep this value + $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty); - + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc); + $info_bits = 0; if ($tva_npr) $info_bits |= 0x01; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5f92fc95785..f6e6d108be8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2045,8 +2045,8 @@ class Facture extends CommonInvoice * @param double $pu_ht Unit price without tax (> 0 even for credit note) * @param double $qty Quantity * @param double $txtva Force vat rate, -1 for auto - * @param double $txlocaltax1 Local tax 1 rate - * @param double $txlocaltax2 Local tax 2 rate + * @param double $txlocaltax1 Local tax 1 rate (deprecated) + * @param double $txlocaltax2 Local tax 2 rate (deprecated) * @param int $fk_product Id of predefined product/service * @param double $remise_percent Percent of discount on line * @param int $date_start Date start of service @@ -2141,6 +2141,7 @@ class Facture extends CommonInvoice // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); + $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, $situation_percent); @@ -2299,7 +2300,8 @@ class Facture extends CommonInvoice // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); - + $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent); $total_ht = $tabprice[0]; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index e38bb254f79..27fcee1dbeb 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1260,7 +1260,8 @@ class Contrat extends CommonObject // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); - + $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -1441,7 +1442,8 @@ class Contrat extends CommonObject // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); - + $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 555b44423e1..49d5265e0f8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3857,12 +3857,12 @@ class Form dol_syslog(__METHOD__, LOG_DEBUG); - $sql = "SELECT DISTINCT t.taux, t.recuperableonly"; + $sql = "SELECT DISTINCT t.code, t.taux, t.recuperableonly"; $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; $sql.= " WHERE t.fk_pays = c.rowid"; $sql.= " AND t.active > 0"; $sql.= " AND c.code IN (".$country_code.")"; - $sql.= " ORDER BY t.taux ASC, t.recuperableonly ASC"; + $sql.= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC"; $resql=$this->db->query($sql); if ($resql) @@ -3873,8 +3873,9 @@ class Form for ($i = 0; $i < $num; $i++) { $obj = $this->db->fetch_object($resql); + $this->cache_vatrates[$i]['code'] = $obj->code; $this->cache_vatrates[$i]['txtva'] = $obj->taux; - $this->cache_vatrates[$i]['libtva'] = $obj->taux.'%'; + $this->cache_vatrates[$i]['libtva'] = $obj->taux.'%'.($obj->code?' ('.$obj->code.')':''); // Label must contains only 0-9 , . % or * $this->cache_vatrates[$i]['nprtva'] = $obj->recuperableonly; } @@ -3897,7 +3898,7 @@ class Form * Output an HTML select vat rate. * The name of this function should be selectVat. We keep bad name for compatibility purpose. * - * @param string $htmlname Name of html select field + * @param string $htmlname Name of HTML select field * @param float $selectedrate Force preselected vat rate. Use '' for no forcing. * @param Societe $societe_vendeuse Thirdparty seller * @param Societe $societe_acheteuse Thirdparty buyer @@ -3910,10 +3911,11 @@ class Form * Si vendeur et acheteur dans Communauté européenne et acheteur= particulier alors TVA par défaut=TVA du produit vendu. Fin de règle. * Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TVA par défaut=0. Fin de règle. * Sinon la TVA proposee par defaut=0. Fin de regle. - * @param bool $options_only Return options only (for ajax treatment) + * @param bool $options_only Return HTML options lines only (for ajax treatment) + * @param int $addcode Add code into key in select list * @return string */ - function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false) + function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false, $addcode=0) { global $langs,$conf,$mysoc; @@ -4016,13 +4018,16 @@ class Form $return.= '