From 57f8f30494a8cecb5e68faa1f6ecbd9a2bc8ffa3 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 21 Jan 2014 12:57:32 +0100 Subject: [PATCH 01/30] Correction Reset Mask (before do not work with FA{yy}{mm}-{0000@99} with date 2014-01-01) --- htdocs/core/lib/functions2.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 145049c999c..d8ff3b3eafe 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -612,13 +612,13 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($maskraz > 0) // A reset is required { if ($maskraz == 99) { - $maskraz = date('m'); + $maskraz = date('m',$date); $resetEveryMonth = true; } if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; // Define posy, posm and reg - if ($maskraz > 1) + if ($maskraz >= 1) { if (! preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode) && ! preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; From 398e286be9393463c6ef749077d95ff352e00a2f Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 21 Jan 2014 12:58:25 +0100 Subject: [PATCH 02/30] Fix reset Mask (befor do not work with FA{yy}{mm}-{0000@99} and date 2014-01-01) --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 22b90ef52e0..d429192dbd9 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -635,7 +635,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; // Define posy, posm and reg - if ($maskraz > 1) // if reset is not first month, we need month and year into mask + if ($maskraz >= 1) // if reset is not first month, we need month and year into mask { if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; } elseif (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; } From 79c2e314390192370cff2bcefa79d9909bf1df38 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 21 Jan 2014 13:47:48 +0100 Subject: [PATCH 03/30] Fix mask --- htdocs/core/lib/functions2.lib.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index d8ff3b3eafe..7d642eaf6dd 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -534,10 +534,10 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m // but we should use local year and month of user // For debugging - //include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'); - //$mask='{yyyy}-{0000}'; + include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'); + $mask='FA{yy}{mm}-{0000@99}'; //$date=dol_mktime(12, 0, 0, 1, 1, 1900); - //$date=dol_stringtotime('20121001'); + $date=dol_stringtotime('20130101'); // Extract value for mask counter, mask raz and mask offset if (! preg_match('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; @@ -618,7 +618,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; // Define posy, posm and reg - if ($maskraz >= 1) + if ($maskraz >= 1 && $resetEveryMonth) { if (! preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode) && ! preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; @@ -626,10 +626,17 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m elseif (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; } if (dol_strlen($reg[$posy]) < 2) return 'ErrorCantUseRazWithYearOnOneDigit'; } - else + elseif ($maskraz > 1) { - if (! preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazIfNoYearInMask'; - if (preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=0; } + if (! preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode) + && ! preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; + if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; } + elseif (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; } + if (dol_strlen($reg[$posy]) < 2) return 'ErrorCantUseRazWithYearOnOneDigit'; + + } else { + if (! preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazIfNoYearInMask'; + if (preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=0; } } //print "x".$maskwithonlyymcode." ".$maskraz." ".$posy." ".$posm; //var_dump($reg); From cd84a5fd17c72496cf26d06e7ddbba9908415e4d Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 21 Jan 2014 13:48:47 +0100 Subject: [PATCH 04/30] remove debug --- htdocs/core/lib/functions2.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 7d642eaf6dd..40b872520a5 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -534,10 +534,10 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m // but we should use local year and month of user // For debugging - include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'); - $mask='FA{yy}{mm}-{0000@99}'; + //include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'); + //$mask='FA{yy}{mm}-{0000@99}'; //$date=dol_mktime(12, 0, 0, 1, 1, 1900); - $date=dol_stringtotime('20130101'); + //$date=dol_stringtotime('20130101'); // Extract value for mask counter, mask raz and mask offset if (! preg_match('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; From a7c892e23b102fef5704e232364ebfc56fdc1c9b Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 21 Jan 2014 14:18:00 +0100 Subject: [PATCH 05/30] Fix Mask numbering --- htdocs/core/lib/functions2.lib.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 5b5bdf838f9..2e8ac94d0a3 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -635,20 +635,25 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; // Define posy, posm and reg - if ($maskraz >= 1) // if reset is not first month, we need month and year into mask + if ($maskraz >= 1 && $resetEveryMonth) { + if (! preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode) + && ! preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; } elseif (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; } - else return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; - if (dol_strlen($reg[$posy]) < 2) return 'ErrorCantUseRazWithYearOnOneDigit'; } - else // if reset is for a specific month in year, we need year + elseif ($maskraz > 1) { - if (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; } - else if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; } - else if (preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=0; } - else return 'ErrorCantUseRazIfNoYearInMask'; + if (! preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode) + && ! preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; + if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; } + elseif (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; } + if (dol_strlen($reg[$posy]) < 2) return 'ErrorCantUseRazWithYearOnOneDigit'; + + } else { + if (! preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazIfNoYearInMask'; + if (preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=0; } } // Define length $yearlen = $posy?dol_strlen($reg[$posy]):0; From 98805ace4aa32317b8e173a2ad3c8440e7244146 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jan 2014 00:25:42 +0100 Subject: [PATCH 06/30] Fix: Error management when deleting a payment on supplier invoice. --- htdocs/fourn/class/paiementfourn.class.php | 7 +++++-- htdocs/fourn/facture/fiche.php | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index a1324f774ae..582d9158a3c 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -305,8 +305,11 @@ class PaiementFourn extends Paiement if ($bank_line_id) { $accline = new AccountLine($this->db); - $accline->fetch($bank_line_id); - $result=$accline->delete(); + $result=$accline->fetch($bank_line_id); + if ($result > 0) // If result = 0, record not found, we don't try to delete + { + $result=$accline->delete(); + } if ($result < 0) { $this->error=$accline->error; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index c2dc17f798f..6acd960270f 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -234,14 +234,14 @@ elseif ($action == 'setnote_private' && $user->rights->fournisseur->facture->cre } // Delete payment -elseif ($action == 'deletepaiement') +elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->creer) { $object->fetch($id); - if ($object->statut == 1 && $object->paye == 0 && $user->societe_id == 0) + if ($object->statut == 1 && $object->paye == 0) { - $paiementfourn = new PaiementFourn($db); - $paiementfourn->fetch(GETPOST('paiement_id')); - $result=$paiementfourn->delete(); + $paiementfourn = new PaiementFourn($db); + $result=$paiementfourn->fetch(GETPOST('paiement_id')); + if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found if ($result < 0) $mesg='
'.$paiementfourn->error.'
'; } } @@ -1527,7 +1527,7 @@ else $bankaccountstatic->ref=$objp->ref; $bankaccountstatic->label=$objp->ref; print ''; - print $bankaccountstatic->getNomUrl(1,'transactions'); + if ($objp->baid > 0) print $bankaccountstatic->getNomUrl(1,'transactions'); print ''; } print ''.price($objp->amount).''; From f50ad96bebe0121b367fbfbc0fd12a0d30a85b32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jan 2014 23:14:25 +0100 Subject: [PATCH 07/30] Fix: var init at wrong place --- .../boxes/box_graph_product_distribution.php | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index a39b0acf1cb..521dd33f0e2 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -103,9 +103,9 @@ class box_graph_product_distribution extends ModeleBoxes $showordernb=$tmparray['showordernb']; } 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; + 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); if (empty($year)) $year=$nowarray['year']; @@ -114,30 +114,30 @@ class box_graph_product_distribution extends ModeleBoxes 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"); if (empty($conf->service->enabled)) $paramtitle=$langs->trans("Products"); $socid=empty($user->societe_id)?0:$user->societe_id; $userid=0; // No filter on user creation - + + $WIDTH=($nbofgraph >= 2 || ! empty($conf->dol_optimize_smallscreen))?'160':'320'; + $HEIGHT='192'; + if (! empty($conf->facture->enabled) && ! empty($user->rights->facture->lire)) { - - $WIDTH=($nbofgraph >= 2 || ! empty($conf->dol_optimize_smallscreen))?'160':'320'; - $HEIGHT='192'; - + // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showinvoicenb) { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; - + $showpointvalue = 1; $nocolor = 0; $mode='customer'; $stats_invoice = new FactureStats($this->db, $socid, $mode, ($userid>0?$userid:0)); $data1 = $stats_invoice->getAllByProductEntry($year,(GETPOST('action')==$refreshaction?-1:(3600*24))); - if (empty($data1)) + if (empty($data1)) { $showpointvalue=0; $nocolor=1; @@ -157,10 +157,10 @@ class box_graph_product_distribution extends ModeleBoxes $legend[]=$data1[$i][0]; $i++; } - + $px1->SetData($data1); unset($data1); - + if ($nocolor) $px1->SetDataColor(array(array(220,220,220))); $px1->SetPrecisionY(0); $px1->SetLegend($legend); @@ -178,29 +178,29 @@ class box_graph_product_distribution extends ModeleBoxes //$px1->mode='depth'; $px1->SetType(array('pie')); $px1->SetTitle($langs->trans("BoxProductDistributionFor",$paramtitle,$langs->transnoentitiesnoconv("Invoices"))); - + $px1->draw($filenamenb,$fileurlnb); } } } - + if (! empty($conf->propal->enabled) && ! empty($user->rights->propal->lire)) { // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showpropalnb) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php'; - + $showpointvalue = 1; $nocolor = 0; $stats_proposal = new PropaleStats($this->db, $socid, ($userid>0?$userid:0)); $data2 = $stats_proposal->getAllByProductEntry($year,(GETPOST('action')==$refreshaction?-1:(3600*24))); - if (empty($data2)) + if (empty($data2)) { $showpointvalue = 0; $nocolor = 1; $data2=array(array(0=>$langs->trans("None"),1=>1)); } - + $filenamenb = $dir."/prodserforpropal-".$year.".png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=proposalstats&file=prodserforpropal-'.$year.'.png'; @@ -215,10 +215,10 @@ class box_graph_product_distribution extends ModeleBoxes $legend[]=$data2[$i][0]; $i++; } - + $px2->SetData($data2); unset($data2); - + if ($nocolor) $px2->SetDataColor(array(array(220,220,220))); $px2->SetPrecisionY(0); $px2->SetLegend($legend); @@ -248,18 +248,18 @@ class box_graph_product_distribution extends ModeleBoxes if ($showordernb) { include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php'; - + $showpointvalue = 1; $nocolor = 0; $mode='customer'; $stats_order = new CommandeStats($this->db, $socid, $mode, ($userid>0?$userid:0)); $data3 = $stats_order->getAllByProductEntry($year,(GETPOST('action')==$refreshaction?-1:(3600*24))); - if (empty($data3)) + if (empty($data3)) { $showpointvalue = 0; $nocolor = 1; $data3=array(array(0=>$langs->trans("None"),1=>1)); } - + $filenamenb = $dir."/prodserfororder-".$year.".png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=prodserfororder-'.$year.'.png'; @@ -274,10 +274,10 @@ class box_graph_product_distribution extends ModeleBoxes $legend[]=$data3[$i][0]; $i++; } - + $px3->SetData($data3); unset($data3); - + if ($nocolor) $px3->SetDataColor(array(array(220,220,220))); $px3->SetPrecisionY(0); $px3->SetLegend($legend); @@ -299,7 +299,7 @@ class box_graph_product_distribution extends ModeleBoxes } } } - + if (! $mesg) { $stringtoshow=''; @@ -314,17 +314,17 @@ class box_graph_product_distribution extends ModeleBoxes $stringtoshow.='
'; $stringtoshow.=''; $stringtoshow.=''; - if (! empty($conf->facture->enabled) || ! empty($user->rights->facture->lire)) + 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)) + 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)) + if (! empty($conf->commande->enabled) || ! empty($user->rights->commande->lire)) { $stringtoshow.=' '.$langs->trans("ForCustomersOrders"); } From 8e8fb27286d8613fd47569e2f98dde868c0ee3e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jan 2014 01:05:56 +0100 Subject: [PATCH 08/30] No more error for version in module file name. Version is taken from descriptor files. --- build/makepack-dolibarrmodule.pl | 92 ++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 41 deletions(-) diff --git a/build/makepack-dolibarrmodule.pl b/build/makepack-dolibarrmodule.pl index 28220e9df95..e708340266d 100755 --- a/build/makepack-dolibarrmodule.pl +++ b/build/makepack-dolibarrmodule.pl @@ -88,18 +88,6 @@ print "Source directory: $SOURCE\n"; print "Target directory: $NEWDESTI\n"; -# Ask and set version $MAJOR, $MINOR and $BUILD -print "Enter value for version: "; -$PROJVERSION=; -chomp($PROJVERSION); -($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3); -if ($MINOR eq '') -{ - print "Enter value for minor version: "; - $MINOR=; - chomp($MINOR); -} - # Ask module print "Enter name for your module (mymodule, mywonderfulmondule, ... or 'all') : "; $PROJECTINPUT=; @@ -130,6 +118,8 @@ else # Loop on each projects foreach my $PROJECT (@PROJECTLIST) { + $PROJECTLC=lc($PROJECT); + if (! -f "makepack-".$PROJECT.".conf") { print "Error: can't open conf file makepack-".$PROJECT.".conf\n"; @@ -141,9 +131,28 @@ foreach my $PROJECT (@PROJECTLIST) { exit 2; } - $FILENAME="$PROJECT"; - $FILENAMETGZ="module_$PROJECT-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":""); - $FILENAMEZIP="module_$PROJECT-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":""); + # Get version $MAJOR, $MINOR and $BUILD + print "Version detected for module ".$PROJECT.": "; + $result=open(IN,"<".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php"); + if (! $result) { die "Error: Can't open descriptor file ".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n"; } + while() + { + if ($_ =~ /this->version\s*=\s*'([\d\.]+)'/) { $PROJVERSION=$1; break; } + } + close IN; + print $PROJVERSION."\n"; + + ($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3); + if ($MINOR eq '') + { + print "Enter value for minor version for module ".$PROJECT.": "; + $MINOR=; + chomp($MINOR); + } + + $FILENAME="$PROJECTLC"; + $FILENAMETGZ="module_$PROJECTLC-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":""); + $FILENAMEZIP="module_$PROJECTLC-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":""); if (-d "/usr/src/redhat") { # redhat $RPMDIR="/usr/src/redhat"; @@ -230,7 +239,7 @@ foreach my $PROJECT (@PROJECTLIST) { $ret=`rm -fr "$BUILDROOT"`; mkdir "$BUILDROOT"; - mkdir "$BUILDROOT/$PROJECT"; + mkdir "$BUILDROOT/$PROJECTLC"; $result=open(IN,"$BUILDROOT/$PROJECT/build/version-".$PROJECT.".txt"); + open(VF,">$BUILDROOT/$PROJECTLC/build/version-".$PROJECTLC.".txt"); - print "Create version file $BUILDROOT/$PROJECT/build/version-".$PROJECT.".txt with date ".$fulldate."\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT/build"`; + print "Create version file $BUILDROOT/$PROJECTLC/build/version-".$PROJECTLC.".txt with date ".$fulldate."\n"; + $ret=`mkdir -p "$BUILDROOT/$PROJECTLC/build"`; print VF "Version: ".$MAJOR.".".$MINOR.($BUILD ne ''?".$BUILD":"")."\n"; print VF "Build : ".$fulldate."\n"; close VF; } print "Clean $BUILDROOT\n"; - $ret=`rm -fr $BUILDROOT/$PROJECT/.cache`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.project`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.settings`; - $ret=`rm -fr $BUILDROOT/$PROJECT/index.php`; - $ret=`rm -fr $BUILDROOT/$PROJECT/build/html`; - $ret=`rm -fr $BUILDROOT/$PROJECT/documents`; - $ret=`rm -fr $BUILDROOT/$PROJECT/document`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom2`; - $ret=`rm -fr $BUILDROOT/$PROJECT/test`; - $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; - $ret=`rm -fr $BUILDROOT/$PROJECT/CVS* $BUILDROOT/$PROJECT/*/CVS* $BUILDROOT/$PROJECT/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/CVS*`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/.cache`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/.project`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/.settings`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/index.php`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/build/html`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/documents`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/document`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.mysql`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/test`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/Thumbs.db $BUILDROOT/$PROJECTLC/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/*/Thumbs.db`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/CVS* $BUILDROOT/$PROJECTLC/*/CVS* $BUILDROOT/$PROJECTLC/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/*/CVS*`; } # Build package for each target @@ -314,9 +324,9 @@ foreach my $PROJECT (@PROJECTLIST) { unlink "$NEWDESTI/$FILENAMEZIP.zip"; print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n"; - print "Go to directory $BUILDROOT/$PROJECT\n"; + print "Go to directory $BUILDROOT/$PROJECTLC\n"; $olddir=getcwd(); - chdir("$BUILDROOT/$PROJECT"); + chdir("$BUILDROOT/$PROJECTLC"); $cmd= "7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip *"; print $cmd."\n"; $ret= `$cmd`; From 1bdeb171c7090b35bd2c11d33ca56eaf474cd857 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jan 2014 01:33:16 +0100 Subject: [PATCH 09/30] Fix: Missing class --- htdocs/public/demo/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index c962227f18c..0948be50631 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -308,7 +308,7 @@ llxHeaderVierge($langs->trans("DolibarrDemo"), $head); print "\n"; -print ''; +print '
'; print ''; } - + print ''; - + print '
'; print '
Dolibarr logo

'; From 549f5c84262000ad097980dc7a2a5c0c069be228 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jan 2014 17:01:14 +0100 Subject: [PATCH 10/30] Fix: Not existing file --- htdocs/theme/amarok/style.css.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index a7011f06a68..1a6149b76fb 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -70,7 +70,6 @@ if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global- $fontlist='helvetica,arial,tahoma,verdana'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; //'/theme/auguria/img/menus/trtitle.png'; $img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1); -$img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1); $img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); $dol_hide_topmenu=$conf->dol_hide_topmenu; $dol_hide_leftmenu=$conf->dol_hide_leftmenu; From 557fb0a9b1ec90885659a77ea3712cd12737d200 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jan 2014 18:30:45 +0100 Subject: [PATCH 11/30] Fix: miscellaneous css problems Fix: Version was missing into home page when login was already done. --- htdocs/core/class/html.form.class.php | 5 +-- htdocs/core/lib/agenda.lib.php | 48 ++++++++++++++------------- htdocs/index.php | 17 +++++----- 3 files changed, 36 insertions(+), 34 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f2a3ea58754..8b572bc5635 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3735,15 +3735,16 @@ class Form * @param int $maxlen Length maximum for labels * @param int $disabled Html select box is disabled * @param int $sort 'ASC' or 'DESC' =Sort on label, '' or 'NONE'=Do not sort + * @param string $morecss Add more class to css styles * @return string HTML select string */ - function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $option='', $translate=0, $maxlen=0, $disabled=0, $sort='') + function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $option='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='') { global $langs; if ($value_as_key) $array=array_combine($array, $array); - $out=''; if ($show_empty) { diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 8fd4eda6010..082e03e60b1 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -46,7 +46,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $showextcals=array(), $actioncode='') { global $conf, $user, $langs, $db; - + // Filters print ''; print ''; @@ -56,63 +56,63 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; print ''; print ''; - + print ''; - + // Buttons print ''; - + // Legend if ($conf->use_javascript_ajax && is_array($showextcals)) { @@ -144,22 +144,24 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh foreach ($showextcals as $val) { $htmlname = dol_string_nospecial($val['name']); + print ''; + print ' ' . $val ['name']; + print ''; } } } - print ''; + print ''; print '
'; - + print ''; - + if ($canedit) { print ''; print ''; print ''; - + print ''; print ''; - + print ''; print ''; - + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions=new FormActions($db); print ''; print ''; } - + if (! empty($conf->projet->enabled) && $user->rights->projet->lire) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; $formproject=new FormProjets($db); - + print ''; print ''; } - + print '
'; print $langs->trans("ActionsAskedBy"); - print '  '; + print '  '; print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit); print '
'; print $langs->trans("or") . ' ' . $langs->trans("ActionsToDoBy"); - print '  '; + print '  '; print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit); print '
'; print $langs->trans("or") . ' ' . $langs->trans("ActionsDoneBy"); - print '  '; + print '  '; print $form->select_dolusers($filterd, 'userdone', 1, '', ! $canedit); print '
'; print $langs->trans("Type"); - print '  '; - + print '  '; + print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0)); - + print '
'; print $langs->trans("Project").'   '; - print ''; + print ''; $formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 64); print '
'; print '
'; print img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="hideonsmartphone"') . ' '; @@ -123,7 +123,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '
'; print img_picto($langs->trans("ViewList"), 'object_list', 'class="hideonsmartphone"') . ' '; print '
'; print '' . "\n"; - print '
' . $val ['name'] . '
' . $langs->trans("AgendaShowBirthdayEvents") . '
'.$langs->trans("AgendaShowBirthdayEvents").'
'; print '
'; print ''; } diff --git a/htdocs/index.php b/htdocs/index.php index a93e0f10a54..1c30610ba73 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -52,7 +52,11 @@ if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_IN * View */ -llxHeader('',$langs->trans("HomeArea")); +// Title +$title=$langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION; +if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE; + +llxHeader('',$title); print_fiche_titre($langs->trans("HomeArea")); @@ -238,20 +242,15 @@ if (empty($user->societe_id)) $var=!$var; if ($langfile[$key]) $langs->load($langfile[$key]); - $title=$langs->trans($titres[$key]); - /*print ''.img_object($title,$icons[$key]).''; - print ''.$title.''; - print ''.$board->nb[$val].''; - print ''; - */ + $text=$langs->trans($titres[$key]); print ''; print ''; + print ''; } } } From f83b47be9f656c95f5caeaa85c74b16bc4edfc76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jan 2014 18:43:30 +0100 Subject: [PATCH 12/30] Fix: Missing loading lang files. --- htdocs/comm/action/fiche.php | 3 +-- htdocs/ecm/index.php | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 0e8843579fe..18bf3ecc7ed 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -586,11 +586,10 @@ if ($action == 'create') // Project if (! empty($conf->projet->enabled)) { - $formproject=new FormProjets($db); // Projet associe - $langs->load("project"); + $langs->load("projects"); print ''.$langs->trans("Project").''; diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index e7e4498f99d..8cdcc3c2000 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2014 Laurent Destailleur * Copyright (C) 2008-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -401,8 +401,9 @@ llxHeader($moreheadcss.$moreheadjs,$langs->trans("ECMArea"),'','','','',$morejs, // Add sections to manage $rowspan=0; $sectionauto=array(); -if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } +if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) +{ + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } if (! empty($conf->societe->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } if (! empty($conf->propal->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); } if (! empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } @@ -410,7 +411,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { if (! empty($conf->facture->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } - if (! empty($conf->tax->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } + if (! empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } } @@ -803,7 +804,7 @@ if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABL form_attach_new_file(DOL_URL_ROOT.'/ecm/index.php', 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, 'formuserfile'); } From cd277aaf1247ff9d4191be81de3131946122cf1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jan 2014 19:10:05 +0100 Subject: [PATCH 13/30] Fix: Missing translation --- htdocs/core/tpl/document_actions_post_headers.tpl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 20005b08528..eeb598d20f8 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -25,6 +25,7 @@ $langs->load("link"); if ($action == 'delete') { + $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles $ret = $form->form_confirm( $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'), $langs->trans('DeleteFile'), From ee41273286001c3d225287aa1f21be98818a055b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jan 2014 19:27:42 +0100 Subject: [PATCH 14/30] Fix: Count of files were wrong --- htdocs/core/lib/company.lib.php | 8 ++++---- htdocs/core/lib/product.lib.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a81eff0e5c3..4de405e3567 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -127,7 +127,7 @@ function societe_prepare_head($object) // Attached files require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $upload_dir = $conf->societe->dir_output . "/" . $object->id; - $nbFiles = count(dol_dir_list($upload_dir)); + $nbFiles = count(dol_dir_list($upload_dir,'files')); $head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id; $head[$h][1] = $langs->trans("Documents"); if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; @@ -620,7 +620,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') // Copy to clipboard print " "; - + // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { @@ -725,7 +725,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if (!empty($object->country)) $coords .= "
".addslashes($object->country); } - + print ''; print img_picto($langs->trans("Address"), 'object_address.png'); print ''; @@ -744,7 +744,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print img_object($langs->trans("Event"),"action"); print ''; } - + // Edit if ($user->rights->societe->contact->creer) { diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index ccebd10cea5..3eb364e7eb6 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -120,7 +120,7 @@ function product_prepare_head($object, $user) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir)); + $nbFiles = count(dol_dir_list($upload_dir,'files')); $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; From 3efd44fd286cd62dfc44e2b58d41d4e00069d5ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jan 2014 23:23:36 +0100 Subject: [PATCH 15/30] Fix: Enabled in dev mode only --- htdocs/public/test/test_arrays.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 4a4e7bc6f74..fb8274e5524 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -4,7 +4,7 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site. require '../../main.inc.php'; -if (!empty($conf->global->MAIN_FEATURES_LEVEL)) +if (empty($conf->global->MAIN_FEATURES_LEVEL)) { print "Page available onto dev environment only"; exit; From b2477b6764a843cce44775216021d635008d0122 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Mon, 27 Jan 2014 10:36:59 +0100 Subject: [PATCH 16/30] Regression in contact form on Note field It's seems to be a regression to Note field in 3.3 instead of public and private Note introduced in 3.4 (and confirmed in the class -> Note / / deprecated) --- htdocs/contact/fiche.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 88585a230af..0becec81abb 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -744,11 +744,17 @@ else print $form->selectarray('priv',$selectarray,$object->priv,0); print ''; - // Note - print ''.$langs->trans("Note").''; - print ''; + // Note Public + print ''.$langs->trans("NotePublic").''; + $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + print ''; + + // Note Private + print ''.$langs->trans("NotePrivate").''; + $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + print ''; // Statut print ''.$langs->trans("Status").''; @@ -961,10 +967,14 @@ else print $object->LibPubPriv($object->priv); print ''; - // Note - print ''.$langs->trans("Note").''; - print nl2br($object->note); + // Note Public + print ''.$langs->trans("NotePublic").''; + print nl2br($object->note_public); print ''; + + // Note Private + print ''.$langs->trans("NotePrivate").''; + print nl2br($object->note_private); // Statut print ''.$langs->trans("Status").''; From 1ec53873f36e0476f1e796aba00b820801a154ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jan 2014 15:24:30 +0100 Subject: [PATCH 17/30] Fix: Missing date start and end when creating contracts --- htdocs/contrat/fiche.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 06b408d4fa2..613b235826e 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -241,8 +241,8 @@ if ($action == 'add' && $user->rights->contrat->creer) for ($i=0;$i<$num;$i++) { $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); - - if ($product_type == 1) { //only services + + if ($product_type == 1) { //only services // TODO Exclude also deee // service prédéfini if ($lines[$i]->fk_product > 0) { @@ -286,8 +286,8 @@ if ($action == 'add' && $user->rights->contrat->creer) $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, - $date_start =0, - $date_end =0, + $lines[$i]->date_start, + $lines[$i]->date_end, 'HT', 0, $lines[$i]->info_bits, @@ -303,7 +303,6 @@ if ($action == 'add' && $user->rights->contrat->creer) } } - } else { From 526c383f10a674818a16fc6caa2c06ff5a1f6b97 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Wed, 29 Jan 2014 10:11:39 +0100 Subject: [PATCH 18/30] Add complete head into agenda --- htdocs/core/lib/agenda.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 082e03e60b1..e66d24e576e 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -434,6 +434,10 @@ function actions_prepare_head($object) $head[$h][1] = $langs->trans('Info'); $head[$h][2] = 'info'; $h++; + + complete_head_from_modules($conf,$langs,$object,$head,$h,'action'); + + complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove'); return $head; } From 779aaa51ab1a6c5df4b133749dc07c4fe273c111 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Wed, 29 Jan 2014 10:13:00 +0100 Subject: [PATCH 19/30] reset function2.lib.php to orign --- htdocs/core/lib/functions2.lib.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 83252dddde9..c315939d327 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -635,25 +635,20 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; // Define posy, posm and reg - if ($maskraz >= 1 && $resetEveryMonth) + if ($maskraz > 1) // if reset is not first month, we need month and year into mask { - if (! preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode) - && ! preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; } elseif (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; } + else return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; + if (dol_strlen($reg[$posy]) < 2) return 'ErrorCantUseRazWithYearOnOneDigit'; } - elseif ($maskraz > 1) + else // if reset is for a specific month in year, we need year { - if (! preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode) - && ! preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; - if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; } - elseif (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; } - if (dol_strlen($reg[$posy]) < 2) return 'ErrorCantUseRazWithYearOnOneDigit'; - - } else { - if (! preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazIfNoYearInMask'; - if (preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=0; } + if (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; } + else if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; } + else if (preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=0; } + else return 'ErrorCantUseRazIfNoYearInMask'; } // Define length $yearlen = $posy?dol_strlen($reg[$posy]):0; From bd3a64d5802418ddffb548587c397134cb7b1e11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Jan 2014 01:35:01 +0100 Subject: [PATCH 20/30] Add test ($conf->global->FEATURES_LEVEL >= 2) for extrafields on detailed lines because this feature is currently bugged. Should work when the 2 forms (predefined product and free product) will be merged into one (planned for 3.6) --- htdocs/core/lib/invoice.lib.php | 4 +++- htdocs/core/lib/order.lib.php | 3 +++ htdocs/core/lib/propal.lib.php | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 3ad2787826f..7c4f4c0c99b 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -132,11 +132,13 @@ function invoice_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; + if ($conf->global->FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name + { $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines'; $h++; - + } complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice_admin','remove'); diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 216887139d4..535b77a3ee3 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -138,10 +138,13 @@ function order_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; + if ($conf->global->FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name + { $head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines'; $h++; + } complete_head_from_modules($conf,$langs,$object,$head,$h,'order_admin','remove'); diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index d43885adf95..2e0da1e4ff6 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -136,10 +136,13 @@ function propal_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; + if ($conf->global->FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name + { $head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines'; $h++; + } complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_admin','remove'); From 35ddcf29586f52d24633568eea0878b1bbca41dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Jan 2014 01:42:32 +0100 Subject: [PATCH 21/30] Remove from changelog because feature is not stable. --- ChangeLog | 3 --- 1 file changed, 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d204454579..965ff2b3443 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,9 +24,6 @@ For users: - New: Add object_hour and object_date_rfc as substitution tag for open document generation. - New: Add options to send an email when paypal or paybox payment is done. - New: Clone product/service composition. -- New: [ task #926 ] Add extrafield feature on order lines. -- New: [ task #927 ] Add extrafield feature on Proposal lines. -- New: [ task #928 ] Add extrafield feature on invoice lines. - New: Add option ADHERENT_LOGIN_NOT_REQUIRED. - New: Add a cron module to define scheduled jobs. - New: Add new graphical boxes (customer and supplier invoices and orders per month). From 0e9477167d99cedaeecdc99f8fc1130fece48807 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Jan 2014 10:48:10 +0100 Subject: [PATCH 22/30] Fix: Bad output of extrafields when list is used. --- htdocs/core/class/extrafields.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 39916775507..277ee0c5ccd 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -939,17 +939,20 @@ class ExtraFields { $sql.= ' as main'; } - $sql.= ' WHERE '.$selectkey.'=\''.$this->db->escape($value).'\''; + $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'"; //$sql.= ' AND entity = '.$conf->entity; + dol_syslog(get_class($this).':showOutputField:$type=sellist sql='.$sql); $resql = $this->db->query($sql); if ($resql) { + $value=''; // value was used, so now we reste it to use it to build final output + $obj = $this->db->fetch_object($resql); // Several field into label (eq table:code|libelle:rowid) $fields_label = explode('|',$InfoFieldList[1]); - + if(is_array($fields_label)) { foreach ($fields_label as $field_toshow) @@ -972,6 +975,7 @@ class ExtraFields } } } + else dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING); } elseif ($type == 'radio') { From 85436f871ceec8ca0ec5de711d8ed95e3d7d59c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Jan 2014 11:44:31 +0100 Subject: [PATCH 23/30] Sec: Missing permission tests --- htdocs/compta/facture/impayees.php | 9 +++++---- htdocs/compta/paiement/liste.php | 1 + htdocs/compta/paiement/rapport.php | 8 ++++---- .../modules/rapport/pdf_paiement.class.php | 19 ++++++++++++++++--- htdocs/document.php | 8 ++++++++ 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index d1750755835..dd374eb1a6f 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -38,12 +38,13 @@ $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int')); $action = GETPOST('action','alpha'); $option = GETPOST('option'); -$diroutputpdf=$conf->facture->dir_output . '/unpaid/temp'; - // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user,'facture',$id,''); +$diroutputpdf=$conf->facture->dir_output . '/unpaid/temp'; +if (! $user->rights->societe->client->voir || $socid) $diroutputpdf.='/private/'.$user->id; // If user has no permission to see all, output dir is specific to user + /* * Action @@ -221,7 +222,7 @@ if ($search_societe) $sql .= " AND s.nom LIKE '%".$db->escape($search_societ if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'"; if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'"; if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'"; -$sql.= " GROUP BY s.nom, s.rowid, f.facnumber, f.increment, f.total, f.tva, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.rowid, f.fk_statut, f.type "; +$sql.= " GROUP BY s.nom, s.rowid, f.rowid, f.facnumber, f.increment, f.total, f.tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp, f.datef, f.date_lim_reglement, f.paye, f.fk_statut, f.type "; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " ORDER BY "; $listfield=explode(',',$sortfield); diff --git a/htdocs/compta/paiement/liste.php b/htdocs/compta/paiement/liste.php index 16a6c1410e6..32400cf29cc 100644 --- a/htdocs/compta/paiement/liste.php +++ b/htdocs/compta/paiement/liste.php @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("bills"); +$langs->load("compta"); // Security check $facid =GETPOST('facid','int'); diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 9c8febe9e1a..eeeaa715718 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * * 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 @@ -32,16 +32,16 @@ if (! $user->rights->facture->lire) accessforbidden(); $action=GETPOST('action'); -$dir = $conf->facture->dir_output.'/payments'; - $socid=0; if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; - $dir = $conf->facture->dir_output.'/payments/private/'.$user->id; } +$dir = $conf->facture->dir_output.'/payments'; +if (! $user->rights->societe->client->voir || $socid) $dir.='/private/'.$user->id; // If user has no permission to see all, output dir is specific to user + $year = $_GET["year"]; if (! $year) { $year=date("Y"); } diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index b7e2f8e5d91..3d3c45e1963 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2006-2014 Laurent Destailleur * * 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 @@ -93,6 +93,9 @@ class pdf_paiement global $user,$langs,$conf; + $socid=0; + if ($user->societe_id) $socid=$user->societe_id; + if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; @@ -136,11 +139,21 @@ class pdf_paiement $sql.= ", pf.amount as pf_amount "; $sql.= ", p.rowid as prowid"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,"; - $sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf"; - $sql.= " WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid"; + $sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf,"; + $sql.= " ".MAIN_DB_PREFIX."societe as s"; + if (! $user->rights->societe->client->voir && ! $socid) + { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid"; $sql.= " AND f.entity = ".$conf->entity; $sql.= " AND p.fk_paiement = c.id "; $sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'"; + if (! $user->rights->societe->client->voir && ! $socid) + { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + } + if (! empty($socid)) $sql .= " AND s.rowid = ".$socid; $sql.= " ORDER BY p.datep ASC, pf.fk_paiement ASC"; dol_syslog(get_class($this)."::write_file sql=".$sql); diff --git a/htdocs/document.php b/htdocs/document.php index 9815bbdd7e6..bb6bd032301 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -66,6 +66,14 @@ $entity=GETPOST('entity')?GETPOST('entity','int'):$conf->entity; // Security check if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart'); +$socid=0; +if ($user->societe_id > 0) $socid = $user->societe_id; + +// For some module part, dir may be privates +if (in_array($modulepart,array('facture_paiement','unpaid'))) +{ + if (! $user->rights->societe->client->voir || $socid) $original_file='private/'.$user->id.'/'.$original_file; // If user has no permission to see all, output dir is specific to user +} /* * Action From ee72a9a4e6bd93ee47a243dad813fa4be384f5db Mon Sep 17 00:00:00 2001 From: simnandez Date: Thu, 30 Jan 2014 12:20:36 +0100 Subject: [PATCH 24/30] Fix: Default status into contact creation must be Actif --- htdocs/contact/class/contact.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 64cef78239d..c83908b75a9 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Alexandre Spangaro + * 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 @@ -126,7 +127,7 @@ class Contact extends CommonObject if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords($this->firstname); if (! $this->socid) $this->socid = 0; if (! $this->priv) $this->priv = 0; - if (empty($this->statut)) $this->statut = 0; + if (empty($this->statut)) $this->statut = 1; //Defult status to Actif $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople ("; $sql.= " datec"; From 47ff6a68bbeff8bc77ddadf6ab1f8311d29cfd55 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Jan 2014 18:11:40 +0100 Subject: [PATCH 25/30] Fix: Test were inverted. --- htdocs/admin/barcode.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 2e815919672..ebc5e46946c 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -289,8 +289,8 @@ if (! isset($_SERVER['WINDIR'])) print ''; } -// Module produits -if (! empty($conf->societe->enabled)) +// Module products +if (! empty($conf->product->enabled)) { $var=!$var; print "
"; @@ -307,8 +307,8 @@ if (! empty($conf->societe->enabled)) print '
'; } -// Module produits -if (! empty($conf->product->enabled)) +// Module thirdparty +if (! empty($conf->societe->enabled)) { $var=!$var; print "
"; From c5d5d6a8d667be18c16cfad66ccccb0c4f6c3082 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Jan 2014 18:17:52 +0100 Subject: [PATCH 26/30] A better fix to have default statut to enabled when created an address. --- htdocs/contact/class/contact.class.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index c83908b75a9..91e814be7c9 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -67,7 +67,7 @@ class Contact extends CommonObject var $code; var $email; - var $skype; + var $skype; var $jabberid; var $phone_pro; var $phone_perso; @@ -103,6 +103,7 @@ class Contact extends CommonObject function __construct($db) { $this->db = $db; + $this->statut = 1; // By default, status is enabled } /** @@ -125,9 +126,9 @@ class Contact extends CommonObject $this->firstname=trim($this->firstname); if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords($this->lastname); if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords($this->firstname); - if (! $this->socid) $this->socid = 0; - if (! $this->priv) $this->priv = 0; - if (empty($this->statut)) $this->statut = 1; //Defult status to Actif + if (empty($this->socid)) $this->socid = 0; + if (empty($this->priv)) $this->priv = 0; + if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople ("; $sql.= " datec"; @@ -237,7 +238,7 @@ class Contact extends CommonObject $this->phone_perso=trim($this->phone_perso); $this->phone_mobile=trim($this->phone_mobile); $this->jabberid=trim($this->jabberid); - $this->skype=trim($this->skype); + $this->skype=trim($this->skype); $this->fax=trim($this->fax); $this->zip=(empty($this->zip)?'':$this->zip); $this->town=(empty($this->town)?'':$this->town); @@ -261,7 +262,7 @@ class Contact extends CommonObject $sql .= ", poste='".$this->db->escape($this->poste)."'"; $sql .= ", fax='".$this->db->escape($this->fax)."'"; $sql .= ", email='".$this->db->escape($this->email)."'"; - $sql .= ", skype='".$this->db->escape($this->skype)."'"; + $sql .= ", skype='".$this->db->escape($this->skype)."'"; $sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); $sql .= ", note_public = ".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null"); $sql .= ", phone = ".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null"); @@ -1100,7 +1101,5 @@ class Contact extends CommonObject } } - - } ?> From 28b252849f63e436460a9595d8b21b3f10dbc64e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Jan 2014 13:02:48 +0100 Subject: [PATCH 27/30] Fix: W3C --- htdocs/societe/admin/societe.php | 103 ++++++++++++++++--------------- 1 file changed, 53 insertions(+), 50 deletions(-) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 98f8e79fd1c..9834959273c 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -68,33 +68,36 @@ if ($action == 'setcodecompta') } } -if ($action == 'COMPANY_USE_SEARCH_TO_SELECT') +if ($action == 'updateoptions') { - $companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT','alpha'); - $res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } -} - -if ($action == 'CONTACT_USE_SEARCH_TO_SELECT') -{ - $contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha'); - $res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - if (! $error) + if (GETPOST('COMPANY_USE_SEARCH_TO_SELECT')) { - $mesg = "".$langs->trans("SetupSaved").""; + $companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT','alpha'); + $res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } } - else + + if (GETPOST('CONTACT_USE_SEARCH_TO_SELECT')) { - $mesg = "".$langs->trans("Error").""; + $contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha'); + $res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } } } @@ -698,6 +701,11 @@ print_titre($langs->trans("Other")); // Autres options $form=new Form($db); $var=true; + +print ''; +print ''; +print ''; + print ''; print ''; print "\n"; @@ -706,9 +714,6 @@ print ''."\n"; // Utilisation formulaire Ajax sur choix societe $var=!$var; -print ''; -print ''; -print ''; print ""; print ''; if (! $conf->use_javascript_ajax) @@ -727,35 +732,13 @@ else ); print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT",$arrval,$conf->global->COMPANY_USE_SEARCH_TO_SELECT); print '"; } print ''; -print ''; $var=!$var; print ""; -print ''; -if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) -{ - print ''; -} -else -{ - print ''; -} -print ''; - - -$var=!$var; -print ''; -print ''; -print ''; -print ""; print ''; if (! $conf->use_javascript_ajax) { @@ -773,11 +756,30 @@ else ); print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT",$arrval,$conf->global->CONTACT_USE_SEARCH_TO_SELECT); print '"; } print ''; + +$var=!$var; +print ""; +print ''; +if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) +{ + print ''; +} +else +{ + print ''; +} +print ''; + + /* // COMPANY_USE_SEARCH_TO_SELECT $var=!$var; @@ -800,6 +802,7 @@ print ''; print '
".$langs->trans("Parameters")." 
'.$langs->trans("UseSearchToSelectCompany").''; - print ''; + print ''; print "
'.$langs->trans("AddRefInList").''; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); - print '
'.$langs->trans("UseSearchToSelectContact").''; - print ''; + print ''; print "
'.$langs->trans("AddRefInList").''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print '
'; +print ''; dol_fiche_end(); From 40a53d4b57c3c633188e522e22b81d17604e22f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Jan 2014 16:06:28 +0100 Subject: [PATCH 28/30] Fix: used bad constant name --- htdocs/core/lib/invoice.lib.php | 2 +- htdocs/core/lib/order.lib.php | 2 +- htdocs/core/lib/propal.lib.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 7c4f4c0c99b..b3983a0c5ab 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -132,7 +132,7 @@ function invoice_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; - if ($conf->global->FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name { $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 535b77a3ee3..46dca55fb3a 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -138,7 +138,7 @@ function order_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; - if ($conf->global->FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name { $head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 2e0da1e4ff6..8f5e61eecee 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -136,7 +136,7 @@ function propal_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; - if ($conf->global->FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name { $head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); From 7de0438299a4aa47bf3a47a0d679ff2b4d90ef13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Feb 2014 16:26:41 +0100 Subject: [PATCH 29/30] Fix: Link on supplier in document invoice must go to supplier card. --- htdocs/fourn/facture/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 1cd4d982466..6c47f66ec7d 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -120,7 +120,7 @@ if ($object->id > 0) print "\n"; // Thirdparty - print ''.$langs->trans('Supplier').''.$object->thirdparty->getNomUrl(1).''; + print ''.$langs->trans('Supplier').''.$object->thirdparty->getNomUrl(1,'supplier').''; // Type print ''.$langs->trans('Type').''; From 2d15e2c759482bf4d5b711fe1baad081c11073a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Feb 2014 16:31:23 +0100 Subject: [PATCH 30/30] Fix: Link on supplier in document invoice must go to supplier card. --- htdocs/fourn/facture/contact.php | 2 +- htdocs/fourn/facture/fiche.php | 2 +- htdocs/fourn/facture/note.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index c5205c47815..9010abbb50f 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -155,7 +155,7 @@ if ($id > 0 || ! empty($ref)) // Third party print "".$langs->trans("Supplier").""; - print ''.$object->client->getNomUrl(1,'compta').''; + print ''.$object->thirdparty->getNomUrl(1,'supplier').''; print ""; print ''; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 06c8d9d590d..cf47afcf10c 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1520,7 +1520,7 @@ else print ''; // Third party - print ''.$langs->trans('Supplier').''.$societe->getNomUrl(1); + print ''.$langs->trans('Supplier').''.$societe->getNomUrl(1,'supplier'); print '   ('.$langs->trans('OtherBills').')'; print ''; diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index b4bb99dcefc..7947b9be020 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -101,7 +101,7 @@ if ($object->id > 0) print "\n"; // Company - print ''.$langs->trans('Supplier').''.$object->thirdparty->getNomUrl(1).''; + print ''.$langs->trans('Supplier').''.$object->thirdparty->getNomUrl(1,'supplier').''; // Type print ''.$langs->trans('Type').'';