diff --git a/ChangeLog b/ChangeLog index 3af4a6cfe95..cc720cc0c01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -119,6 +119,8 @@ Fix: If only service module is activated, it's impossible to delete service Fix: [ bug #1043 ] Bad interventions ref numbering Fix: Mailing module : if an email is already in destinaires list all other email from selector was not inserted Fix: Localtaxes balance not showing +Fix: Intervention box links to contracts id +Fix: Compatiblity with multicompany module ***** ChangeLog for 3.4 compared to 3.3.* ***** For users: diff --git a/dev/translation/txpull.sh b/dev/translation/txpull.sh index fdd59729791..a572de9bdb9 100755 --- a/dev/translation/txpull.sh +++ b/dev/translation/txpull.sh @@ -11,7 +11,7 @@ if [ "x$1" = "x" ] then echo "This pull remote transifex files to local dir." - echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer." + echo "Note: If you pull a language file (not source), file will be skipped if local file is newer." echo " Using -f will overwrite local file (does not work with 'all')." echo "Usage: txpull.sh (all|xx_XX) [-r dolibarr.file] [-f]" exit diff --git a/doc/images/dolibarr_screenshot1_640x400.png b/doc/images/dolibarr_screenshot1_640x400.png new file mode 100644 index 00000000000..9ed384263ad Binary files /dev/null and b/doc/images/dolibarr_screenshot1_640x400.png differ diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index e60a76bd936..ab964100c04 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -107,8 +107,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg '%MONTH%'=>$month, '%DAY%'=>$day, '%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT, - '%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/", - '%SOCIETE%'=>$objp->company + '%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/" ); complete_substitutions_array($substitutionarray, $langs); @@ -204,7 +203,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg dol_print_error($db); } - if (! $mesg) + if (! $mesg) { $db->close(); exit; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 07912e8759c..b059fa34bec 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -35,6 +35,8 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); +$scandir = GETPOST('scandir','alpha'); +$type='contrat'; if (empty($conf->global->CONTRACT_ADDON)) { @@ -64,11 +66,6 @@ if ($action == 'updateMask') } } -if ($action == 'setmod') -{ - dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity); -} - else if ($action == 'specimen') // For contract { $modele= GETPOST('module','alpha'); @@ -155,10 +152,10 @@ else if ($action == 'setmod') dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity); } -else if ($action == 'set_CONTRAT_FREE_TEXT') +else if ($action == 'set_CONTRACT_FREE_TEXT') { - $freetext= GETPOST('CONTRAT_FREE_TEXT','alpha'); - $res = dolibarr_set_const($db, "CONTRAT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + $freetext= GETPOST('CONTRACT_FREE_TEXT','alpha'); + $res = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -172,11 +169,11 @@ else if ($action == 'set_CONTRAT_FREE_TEXT') } } -else if ($action == 'set_CONTRAT_DRAFT_WATERMARK') +else if ($action == 'set_CONTRACT_DRAFT_WATERMARK') { - $draft= GETPOST('CONTRAT_DRAFT_WATERMARK','alpha'); + $draft= GETPOST('CONTRACT_DRAFT_WATERMARK','alpha'); - $res = dolibarr_set_const($db, "CONTRAT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -492,10 +489,10 @@ $var=true; $var=! $var; print '
'; print ''; -print ''; +print ''; print ''; print $langs->trans("FreeLegalTextOnContracts").' ('.$langs->trans("AddCRIfTooLong").')
'; -print ''; +print ''; print ''; print ''; print "\n"; @@ -505,10 +502,10 @@ print '
'; $var=!$var; print "
"; print ''; -print ""; +print ""; print ''; print $langs->trans("WatermarkOnDraftContractCards").'
'; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 268681a8b46..2690f9de52c 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -5,6 +5,8 @@ * Copyright (C) 2006-2012 Regis Houssin * Copyright (C) 2006-2012 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013 Philippe Grand * * 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 @@ -610,8 +612,7 @@ class Categorie $sql = "SELECT fk_parent as id_parent, rowid as id_son"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie"; $sql.= " WHERE fk_parent != 0"; - $sql.= " AND entity = ".$conf->entity; - + $sql.= " AND entity IN (".getEntity('category',1).")"; dol_syslog(get_class($this)."::load_motherof sql=".$sql); $resql = $this->db->query($sql); if ($resql) diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index 4d199c3d642..245ea4cbc13 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -1,5 +1,6 @@ + * Copyright (C) 2013 Juanjo Menent * * 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 @@ -95,11 +96,11 @@ class box_ficheinter extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/ficheinter/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/fichinter/fiche.php?id=".$objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref - 'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid); + 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some interventions have no ref + 'url' => DOL_URL_ROOT."/fichinter/fiche.php?id=".$objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', @@ -120,9 +121,10 @@ class box_ficheinter extends ModeleBoxes $i++; } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedContracts")); + if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInterventions")); $db->free($resql); + } else { diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 2c63690e547..83baee66ff1 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -69,7 +69,6 @@ class box_graph_product_distribution extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - $facturestatic=new Facture($db); $text = $langs->trans("BoxProductDistribution",$max); $this->info_box_head = array( @@ -90,15 +89,18 @@ class box_graph_product_distribution extends ModeleBoxes $showinvoicenb=GETPOST($param_showinvoicenb,'alpha',4); $showpropalnb=GETPOST($param_showpropalnb,'alpha',4); $showordernb=GETPOST($param_showordernb,'alpha',4); - if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb=1; $showinvoicenb=1; $showordernb=1; } + if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb=0; + if (empty($conf->propal->enabled) || empty($user->rights->propal->lire)) $showpropalnb=0; + if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) $showordernb=0; + $nowarray=dol_getdate(dol_now(),true); $year=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']); - $nbofgraph=0; - if ($showinvoicenb) $nbofgraph++; - if ($showpropalnb) $nbofgraph++; - if ($showordernb) $nbofgraph++; + $nbofgraph=0; + if ($showinvoicenb) $nbofgraph++; + if ($showpropalnb) $nbofgraph++; + if ($showordernb) $nbofgraph++; $paramtitle=$langs->trans("Products").'/'.$langs->trans("Services"); if (empty($conf->produit->enabled)) $paramtitle=$langs->trans("Services"); @@ -107,7 +109,7 @@ class box_graph_product_distribution extends ModeleBoxes $socid=empty($user->societe_id)?0:$user->societe_id; $userid=0; // No filter on user creation - if ($user->rights->facture->lire) + if (! empty($conf->facture->enabled) && ! empty($user->rights->facture->lire)) { include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; @@ -170,7 +172,7 @@ class box_graph_product_distribution extends ModeleBoxes } } - if ($user->rights->propal->lire) + if (! empty($conf->propal->enabled) && ! empty($user->rights->propal->lire)) { // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showpropalnb) @@ -228,7 +230,7 @@ class box_graph_product_distribution extends ModeleBoxes } } - if ($user->rights->commande->lire) + if (! empty($conf->commande->enabled) && ! empty($user->rights->commande->lire)) { // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showordernb) @@ -300,11 +302,20 @@ class box_graph_product_distribution extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("ForCustomersInvoices"); - $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("ForProposals"); - $stringtoshow.=' '; - $stringtoshow.=' '.$langs->trans("ForCustomersOrders"); + if (! empty($conf->facture->enabled) || ! empty($user->rights->facture->lire)) + { + $stringtoshow.=' '.$langs->trans("ForCustomersInvoices"); + $stringtoshow.='   '; + } + if (! empty($conf->propal->enabled) || ! empty($user->rights->propal->lire)) + { + $stringtoshow.=' '.$langs->trans("ForProposals"); + $stringtoshow.=' '; + } + if (! empty($conf->commande->enabled) || ! empty($user->rights->commande->lire)) + { + $stringtoshow.=' '.$langs->trans("ForCustomersOrders"); + } $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; @@ -322,18 +333,18 @@ class box_graph_product_distribution extends ModeleBoxes $stringtoshow.='
'; if ($showinvoicenb) $stringtoshow.=$px1->show(); else if ($showpropalnb) $stringtoshow.=$px2->show(); - $stringtoshow.='
'; + $stringtoshow.='
'; if ($showordernb) $stringtoshow.=$px3->show(); else if ($showpropalnb) $stringtoshow.=$px2->show(); - $stringtoshow.='
'; + $stringtoshow.=''; } - if ($nbofgraph == 3) + if ($nbofgraph == 3) { - $stringtoshow.='
'; - $stringtoshow.=$px1->show(); - $stringtoshow.='
'; - $stringtoshow.=$px2->show(); - $stringtoshow.='
'; + $stringtoshow.='
'; + $stringtoshow.=$px1->show(); + $stringtoshow.='
'; + $stringtoshow.=$px2->show(); + $stringtoshow.='
'; $stringtoshow.='
'; $stringtoshow.=$px3->show(); $stringtoshow.='
'; diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index ac603837240..aa626fdb893 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -71,7 +71,7 @@ class DolGraph var $showlegend=1; var $showpointvalue=1; var $showpercent=0; - + var $graph; // Objet Graph (Artichow, Phplot...) var $error; @@ -244,17 +244,17 @@ class DolGraph $this->data = $data; } - /** - * Set data - * - * @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...) - * @return void - */ - function SetDataColor($datacolor) - { - $this->datacolor = $datacolor; + /** + * Set data + * + * @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...) + * @return void + */ + function SetDataColor($datacolor) + { + $this->datacolor = $datacolor; } - + /** * Set type * @@ -395,7 +395,7 @@ class DolGraph /** * Show legend or not - * + * * @param int $showlegend 1=Show legend (default), 0=Hide legend * @return void */ @@ -406,7 +406,7 @@ class DolGraph /** * Show pointvalue or not - * + * * @param int $showpointvalue 1=Show value for each point, as tooltip or inline (default), 0=Hide value * @return void */ @@ -414,10 +414,10 @@ class DolGraph { $this->showpointvalue=$showpointvalue; } - + /** * Show percent or not - * + * * @param int $showpercent 1=Show percent for each point, as tooltip or inline, 0=Hide percent (default) * @return void */ @@ -425,9 +425,9 @@ class DolGraph { $this->showpercent=$showpercent; } - - - + + + /** * Define background color of complete image * @@ -590,12 +590,18 @@ class DolGraph /** * Build a graph onto disk using correct library * - * @param string $file Image file name to use if we save onto disk + * @param string $file Image file name to use to save onto disk (also used as javascript unique id) * @param string $fileurl Url path to show image if saved onto disk * @return void */ function draw($file,$fileurl='') { + if (empty($file)) + { + $this->error="Call to draw method was made with empty value for parameter file."; + dol_syslog(get_class($this)."::draw ".$this->error, LOG_ERR); + return -2; + } if (! is_array($this->data) || count($this->data) < 1) { $this->error="Call to draw method was made but SetData was not called or called with an empty dataset for parameters"; @@ -796,8 +802,8 @@ class DolGraph * $this->mode = 'depth' ??? * $this->bgcolorgrid * $this->datacolor - * - * @param string $file Image file name to use if we save onto disk + * + * @param string $file Image file name to use to save onto disk (also used as javascript unique id) * @param string $fileurl Url path to show image if saved onto disk * @return void */ @@ -807,6 +813,12 @@ class DolGraph dol_syslog(get_class($this)."::draw_jflot this->type=".join(',',$this->type)); + if (empty($this->width) && empty($this->height)) + { + print 'Error width or height not set'; + return; + } + $legends=array(); $nblot=count($this->data[0])-1; // -1 to remove legend if ($nblot < 0) dol_print_error('Bad value for property ->data. Must be set by mydolgraph->SetData before callinf mydolgrapgh->draw'); @@ -823,7 +835,7 @@ class DolGraph // Fill array $values $x=0; - foreach($this->data as $valarray) // Loop on each x + foreach($this->data as $valarray) // Loop on each x { $legends[$x] = $valarray[0]; $values[$x] = (is_numeric($valarray[$i+1]) ? $valarray[$i+1] : null); @@ -839,12 +851,12 @@ class DolGraph { foreach($values as $x => $y) { if (isset($y)) $serie[$i].='d'.$i.'.push(['.$x.', '.$y.']);'."\n"; } } - + unset($values); $i++; } $tag=dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file),'_',array('-','.')))); - + $this->_stringtoshow =''."\n"; if (! empty($this->title)) $this->_stringtoshow.='
'.$this->title.'
'; $this->_stringtoshow.='
'."\n"; @@ -868,7 +880,7 @@ class DolGraph $showlegend=$this->showlegend; $showpointvalue=$this->showpointvalue; $showpercent=$this->showpercent; - + $this->_stringtoshow.= ' function plotWithOptions_'.$tag.'() { $.plot($("#placeholder_'.$tag.'"), d0, @@ -933,16 +945,16 @@ class DolGraph opacity: 0.80 }).appendTo("body").fadeIn(20); } - + var previousPoint = null; $("#placeholder_'.$tag.'").bind("plothover", function (event, pos, item) { $("#x").text(pos.x.toFixed(2)); $("#y").text(pos.y.toFixed(2)); - + if (item) { if (previousPoint != item.dataIndex) { previousPoint = item.dataIndex; - + $("#tooltip").remove(); /* console.log(item); */ var x = item.datapoint[0].toFixed(2); @@ -962,9 +974,9 @@ class DolGraph } }); '; - + $this->_stringtoshow.='var stack = null, steps = false;'."\n"; - + $this->_stringtoshow.='function plotWithOptions_'.$tag.'() {'."\n"; $this->_stringtoshow.='$.plot($("#placeholder_'.$tag.'"), [ '."\n"; $i=$firstlot; @@ -979,7 +991,7 @@ class DolGraph $i++; } $this->_stringtoshow.="\n".' ], { series: { stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6 } }'."\n"; - + // Xaxis $this->_stringtoshow.=', xaxis: { ticks: ['."\n"; $x=0; @@ -990,10 +1002,10 @@ class DolGraph $x++; } $this->_stringtoshow.='] }'."\n"; - + // Yaxis $this->_stringtoshow.=', yaxis: { min: '.$this->MinValue.', max: '.($this->MaxValue).' }'."\n"; - + // Background color $color1=sprintf("%02x%02x%02x",$this->bgcolorgrid[0],$this->bgcolorgrid[0],$this->bgcolorgrid[2]); $color2=sprintf("%02x%02x%02x",$this->bgcolorgrid[0],$this->bgcolorgrid[1],$this->bgcolorgrid[2]); @@ -1001,7 +1013,7 @@ class DolGraph //$this->_stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this $this->_stringtoshow.='});'."\n"; $this->_stringtoshow.='}'."\n"; - + } $this->_stringtoshow.='plotWithOptions_'.$tag.'();'."\n"; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 051c9950fd2..469f6e02fbc 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -683,9 +683,9 @@ class ExtraFields } elseif ($type == 'sellist') { - $out='