From 7f950d8b4560579ca9614e68a80bab4e53843cd5 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Thu, 21 Nov 2013 12:28:51 +0100 Subject: [PATCH 01/33] Fix user pram_ihm, display tab and allow modify button only is user right allow it is OK --- htdocs/core/lib/usergroups.lib.php | 11 +++++++---- htdocs/user/param_ihm.php | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 041234bf20666..41fca18e278b0 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -66,10 +66,13 @@ function user_prepare_head($object) $h++; } - $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id; - $head[$h][1] = $langs->trans("UserGUISetup"); - $head[$h][2] = 'guisetup'; - $h++; + //Display this tab only if can updte information + if (!empty($user->admin) || !empty($user->rights->user->self->creer)) { + $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id; + $head[$h][1] = $langs->trans("UserGUISetup"); + $head[$h][2] = 'guisetup'; + $h++; + } if (! empty($conf->clicktodial->enabled)) { diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 54a9093bd34cc..a6b718f83b8ef 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -258,7 +258,7 @@ } else { - if ($user->id == $fuser->id || ! empty($user->admin)) // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin + if (($user->id == $fuser->id || ! empty($user->admin)) && $caneditfield) // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin { print 'id.'">'.$langs->trans("Modify").''; } From f852c9a5bbc56e01b7b9c4cfa648dbf93fd436c4 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Fri, 22 Nov 2013 14:43:15 +0100 Subject: [PATCH 02/33] Fix [ bug #1145 ] Agenda button list type do not display --- ChangeLog | 3 +- htdocs/core/lib/agenda.lib.php | 218 ++++++++++++++++----------------- 2 files changed, 106 insertions(+), 115 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6d72624b4d30..4702e01e0a18d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,7 +8,8 @@ Fix: Bad rounding on margin calculations and display. Fix: Option drop table into backup was broken. Fix: [ bug #1105 ] Searching Boxes other search option Fix: wrong buy price update -Fix :[ bug #1142 ] Set paiement on invoice (PGSql) +Fix: [ bug #1142 ] Set paiement on invoice (PGSql) +Fix: [ bug #1145 ] Agenda button list type do not display ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index dda971668def6..32584a19a9b5e 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -43,126 +43,116 @@ * @param string $actioncode Preselected value of actioncode for filter on type * @return void */ -function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$showextcals=array(),$actioncode='') -{ - global $conf,$user,$langs,$db; +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 - if ($canedit || ! empty($conf->projet->enabled)) - { - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($canedit || ! empty($conf->projet->enabled)) - { - print ''; - - // Buttons - print ''; - - // Legend - if ($conf->use_javascript_ajax && is_array($showextcals)) - { - print ''; + print ''; + print ''; + print ''; + print ''; + 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) - { - print ''; - print ''; - } - - print '
'; - print $langs->trans("ActionsAskedBy"); - print '  '; - print $form->select_dolusers($filtera,'userasked',1,'',!$canedit); - print '
'; - print $langs->trans("or").' '.$langs->trans("ActionsToDoBy"); - print '  '; - print $form->select_dolusers($filtert,'usertodo',1,'',!$canedit); - print '
'; - print $langs->trans("or").' '.$langs->trans("ActionsDoneBy"); - print '  '; - print $form->select_dolusers($filterd,'userdone',1,'',!$canedit); - print '
'; - print $langs->trans("Type"); - print '  '; - - print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0)); - - print '
'; - print $langs->trans("Project").'   '; - print ''; - select_projects($socid?$socid:-1, $pid, 'projectid', 64); - print '
'; - print '
'; - print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; - print '
'; - print img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone"').' '; - print '
'; - print img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone"').' '; - print '
'; - print img_picto($langs->trans("ViewList"),'object_list','class="hideonsmartphone"').' '; - print '
'; - print ''."\n"; - print ''; - if (! empty($conf->global->MAIN_JS_SWITCH_AGENDA)) - { - if (count($showextcals) > 0) - { - print ''; - foreach($showextcals as $val) - { - $htmlname=dol_string_nospecial($val['name']); - print ''."\n"; - print ''; - } - } - } - print ''; - print '
'.$langs->trans("LocalAgenda").'
'.$val['name'].'
'.$langs->trans("AgendaShowBirthdayEvents").'
'; - print '
'; + + print ''; + + // Buttons + print ''; + + // Legend + if ($conf->use_javascript_ajax && is_array ( $showextcals )) { + 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) { + print ''; + print ''; + } + + print '
'; + print $langs->trans ( "ActionsAskedBy" ); + print '  '; + print $form->select_dolusers ( $filtera, 'userasked', 1, '', ! $canedit ); + print '
'; + print $langs->trans ( "or" ) . ' ' . $langs->trans ( "ActionsToDoBy" ); + print '  '; + print $form->select_dolusers ( $filtert, 'usertodo', 1, '', ! $canedit ); + print '
'; + print $langs->trans ( "or" ) . ' ' . $langs->trans ( "ActionsDoneBy" ); + print '  '; + print $form->select_dolusers ( $filterd, 'userdone', 1, '', ! $canedit ); + print '
'; + print $langs->trans ( "Type" ); + print '  '; + + print $formactions->select_type_actions ( $actioncode, "actioncode", '', (empty ( $conf->global->AGENDA_USE_EVENT_TYPE ) ? 1 : 0) ); + + print '
'; + print $langs->trans ( "Project" ) . '   '; + print ''; + select_projects ( $socid ? $socid : - 1, $pid, 'projectid', 64 ); + print '
'; + print '
'; + print img_picto ( $langs->trans ( "ViewCal" ), 'object_calendar', 'class="hideonsmartphone"' ) . ' '; + print '
'; + print img_picto ( $langs->trans ( "ViewWeek" ), 'object_calendarweek', 'class="hideonsmartphone"' ) . ' '; + print '
'; + print img_picto ( $langs->trans ( "ViewDay" ), 'object_calendarday', 'class="hideonsmartphone"' ) . ' '; + print '
'; + print img_picto ( $langs->trans ( "ViewList" ), 'object_list', 'class="hideonsmartphone"' ) . ' '; + print '
'; + print '' . "\n"; + print ''; + if (! empty ( $conf->global->MAIN_JS_SWITCH_AGENDA )) { + if (count ( $showextcals ) > 0) { + print ''; + foreach ( $showextcals as $val ) { + $htmlname = dol_string_nospecial ( $val ['name'] ); + print '' . "\n"; + print ''; + } } - - print ''; } + print ''; print '
' . $langs->trans ( "LocalAgenda" ) . '
' . $val ['name'] . '
' . $langs->trans ( "AgendaShowBirthdayEvents" ) . '
'; - print ''; + print '
'; + print ''; } From 6615ee7e6f12a8298b29ae84e95c90966f7d75a8 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sat, 23 Nov 2013 14:59:28 +0100 Subject: [PATCH 03/33] [ bug #1148 ] Product consomation : supplier order bad status --- ChangeLog | 1 + htdocs/product/stats/commande_fournisseur.php | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4702e01e0a18d..c49735f97e0aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ Fix: [ bug #1105 ] Searching Boxes other search option Fix: wrong buy price update Fix: [ bug #1142 ] Set paiement on invoice (PGSql) Fix: [ bug #1145 ] Agenda button list type do not display +Fix: [ bug #1148 ] Product consomation : supplier order bad status ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 0e8b5509149c3..f8d73c3e5e988 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -25,7 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $langs->load("orders"); @@ -136,8 +136,8 @@ print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"c.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print "\n"; - $commandestatic=new Commande($db); - + $commandestatic=new CommandeFournisseur($db); + if ($num > 0) { $var=True; @@ -145,17 +145,19 @@ { $objp = $db->fetch_object($result); $var=!$var; + + $commandestatic->id=$objp->commandeid; + $commandestatic->ref=$objp->ref; + $commandestatic->statut=$objp->statut; print ""; - print ''.img_object($langs->trans("ShowOrder"),"order").' '; - print $objp->ref; - print "\n"; + print ''.$commandestatic->getNomUrl(1)."\n"; print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).''; print "".$objp->code_client."\n"; print ""; print dol_print_date($db->jdate($objp->date_commande)).""; print "".price($objp->total_ht)."\n"; - print ''.$commandestatic->LibStatut($objp->statut,$objp->facture,5).''; + print ''.$commandestatic->getLibStatut(4).''; print "\n"; $i++; } From 65b6dca55481b1c7a402f816a8341c78ce10fbc5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Nov 2013 13:40:33 +0100 Subject: [PATCH 04/33] Fix: business rule to protect button and action was not synchronized --- htdocs/user/param_ihm.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 54a9093bd34cc..44686e9277ec7 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * @@ -78,7 +78,7 @@ /* * Actions */ -if ($action == 'update' && ($caneditfield || $user->admin)) +if ($action == 'update' && ($caneditfield || ! empty($user->admin))) { if (! $_POST["cancel"]) { @@ -258,7 +258,7 @@ } else { - if ($user->id == $fuser->id || ! empty($user->admin)) // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin + if ($caneditfield || ! empty($user->admin)) // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin { print 'id.'">'.$langs->trans("Modify").''; } From 8f9143cef7065c7b9dacbf5e405bb385b707b6e4 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sun, 24 Nov 2013 18:07:40 +0100 Subject: [PATCH 05/33] revert param_ihm --- htdocs/core/lib/usergroups.lib.php | 11 ++++------- htdocs/user/param_ihm.php | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 41fca18e278b0..041234bf20666 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -66,13 +66,10 @@ function user_prepare_head($object) $h++; } - //Display this tab only if can updte information - if (!empty($user->admin) || !empty($user->rights->user->self->creer)) { - $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id; - $head[$h][1] = $langs->trans("UserGUISetup"); - $head[$h][2] = 'guisetup'; - $h++; - } + $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id; + $head[$h][1] = $langs->trans("UserGUISetup"); + $head[$h][2] = 'guisetup'; + $h++; if (! empty($conf->clicktodial->enabled)) { diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index a6b718f83b8ef..54a9093bd34cc 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -258,7 +258,7 @@ } else { - if (($user->id == $fuser->id || ! empty($user->admin)) && $caneditfield) // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin + if ($user->id == $fuser->id || ! empty($user->admin)) // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin { print 'id.'">'.$langs->trans("Modify").''; } From baebc7e91db24dba5fd6ff7238afd918d03f501c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Nov 2013 19:33:22 +0100 Subject: [PATCH 06/33] Fix: Not coherent filename --- 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 05eef72a97866..6390e6c81f5ab 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -483,11 +483,12 @@ $newbuild =~ s/(dev|alpha)/0.1.a/gi; # dev $newbuild =~ s/beta/0.2.beta1/gi; # beta $newbuild =~ s/rc./0.3.rc1/gi; # rc - if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale + if ($newbuild !~ /-/) { $newbuild.='-0.3'; } # finale #$newbuild =~ s/(dev|alpha)/0/gi; # dev #$newbuild =~ s/beta/1/gi; # beta #$newbuild =~ s/rc./2/gi; # rc #if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale + #print "newbuild=".$newbuild."\n";exit; $REL1 = $newbuild; $REL1 =~ s/-.*$//gi; if ($RPMSUBVERSION eq 'auto') { $RPMSUBVERSION = $newbuild; $RPMSUBVERSION =~ s/^.*-//gi; } print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n"; From 1ddf9f6ac55eac39fd789a6868429f54cd065e27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Nov 2013 19:33:22 +0100 Subject: [PATCH 07/33] Fix: Not coherent filename --- 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 f2826cf35b11e..4537c68d7e225 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -481,11 +481,12 @@ $newbuild =~ s/(dev|alpha)/0.1.a/gi; # dev $newbuild =~ s/beta/0.2.beta1/gi; # beta $newbuild =~ s/rc./0.3.rc1/gi; # rc - if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale + if ($newbuild !~ /-/) { $newbuild.='-0.3'; } # finale #$newbuild =~ s/(dev|alpha)/0/gi; # dev #$newbuild =~ s/beta/1/gi; # beta #$newbuild =~ s/rc./2/gi; # rc #if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale + #print "newbuild=".$newbuild."\n";exit; $REL1 = $newbuild; $REL1 =~ s/-.*$//gi; if ($RPMSUBVERSION eq 'auto') { $RPMSUBVERSION = $newbuild; $RPMSUBVERSION =~ s/^.*-//gi; } print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n"; From 2178ab60076b7dfa1ea3b6189056a4d535d43278 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Wed, 27 Nov 2013 22:05:29 +0100 Subject: [PATCH 08/33] Fix [ bug #1156 ] Update TVA mass update tools do not work --- htdocs/product/admin/product_tools.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index aafe01bbb019b..e3ba408bc16d2 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -107,7 +107,7 @@ $newlevel=$level; //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + $retm=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); if ($retm < 0) { $error++; @@ -136,7 +136,7 @@ if (! empty($price_base_type) && ! $updatelevel1) { //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + $ret=$objectstatic->updatePrice($objectstatic->id,$newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); } if ($ret < 0 || $retm < 0) $error++; From b9d37fd6f7ab4625d11e866284df79176f0e72a5 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Thu, 28 Nov 2013 14:28:03 +0100 Subject: [PATCH 09/33] [ bug #1159 ] Commercial search "other" give p.note do not exists --- ChangeLog | 1 + htdocs/comm/propal/list.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c49735f97e0aa..f18248c35fc1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ Fix: wrong buy price update Fix: [ bug #1142 ] Set paiement on invoice (PGSql) Fix: [ bug #1145 ] Agenda button list type do not display Fix: [ bug #1148 ] Product consomation : supplier order bad status +Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 2e3b70a8ca32c..aba10e2ca6977 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -167,7 +167,7 @@ { $sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'"; } -if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%' OR pd.description LIKE '%".$db->escape($sall)."%')"; +if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR p.note_private LIKE '%".$db->escape($sall)."%' OR p.note_public LIKE '%".$db->escape($sall)."%' OR pd.description LIKE '%".$db->escape($sall)."%')"; if ($socid) $sql.= ' AND s.rowid = '.$socid; if ($viewstatut <> '') { From a7c246cec1590d33c7e63ca69eeb9509fd3d9b0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 15:20:57 +0100 Subject: [PATCH 10/33] Check parameters of script --- build/makepack-dolibarr.pl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 4537c68d7e225..44c3ede148995 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -59,6 +59,14 @@ $SOURCE="$DIR/.."; $DESTI="$SOURCE/build"; +if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"}) +{ + print "Error: Missing environment variables.\n"; + print "You must define the environment variable DESTIBETARC and DESTISTABLE to point to the\ndirectories where you want to save the generated packages.\n"; + print "$PROG.$Extension aborted.\n"; + sleep 2; + exit 1; +} # Detect OS type # -------------- @@ -66,7 +74,7 @@ elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; } elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; } if (! $OS) { - print "$PROG.$Extension was not able to detect your OS.\n"; + print "Error: Can't detect your OS.\n"; print "Can't continue.\n"; print "$PROG.$Extension aborted.\n"; sleep 2; @@ -105,8 +113,8 @@ $FILENAMESNAPSHOT.="-".$PREFIX; } } -if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTI is defined -if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTI is defined +if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTI is defined +if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTI is defined print "Makepack version $VERSION\n"; From 71a85464d562ed93b62cd38a71ac167c7e017042 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 15:20:57 +0100 Subject: [PATCH 11/33] Check parameters of script --- build/makepack-dolibarr.pl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 6390e6c81f5ab..85e6061a5205f 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -59,6 +59,14 @@ $SOURCE="$DIR/.."; $DESTI="$SOURCE/build"; +if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"}) +{ + print "Error: Missing environment variables.\n"; + print "You must define the environment variable DESTIBETARC and DESTISTABLE to point to the\ndirectories where you want to save the generated packages.\n"; + print "$PROG.$Extension aborted.\n"; + sleep 2; + exit 1; +} # Detect OS type # -------------- @@ -66,7 +74,7 @@ elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; } elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; } if (! $OS) { - print "$PROG.$Extension was not able to detect your OS.\n"; + print "Error: Can't detect your OS.\n"; print "Can't continue.\n"; print "$PROG.$Extension aborted.\n"; sleep 2; @@ -105,8 +113,8 @@ $FILENAMESNAPSHOT.="-".$PREFIX; } } -if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTI is defined -if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTI is defined +if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTI is defined +if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTI is defined print "Makepack version $VERSION\n"; From 395066519b5c7f3d6dafa8dcdd45583509f612d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 16:18:18 +0100 Subject: [PATCH 12/33] Fix: [ bug #1163 ] SQL Error when searching for supplier orders --- ChangeLog | 2 ++ htdocs/fourn/commande/liste.php | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f18248c35fc1f..1ea35d60a0ab9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ -------------------------------------------------------------- English Dolibarr ChangeLog -------------------------------------------------------------- + ***** ChangeLog for 3.4.2 compared to 3.4.1 ***** Fix: field's problem into company's page (RIB) Fix: Document cerfa doesn't contained firstname & lastname from donator @@ -12,6 +13,7 @@ Fix: [ bug #1142 ] Set paiement on invoice (PGSql) Fix: [ bug #1145 ] Agenda button list type do not display Fix: [ bug #1148 ] Product consomation : supplier order bad status Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists +Fix: [ bug #1163 ] SQL Error when searching for supplier orders ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php index 76270c8ea20ba..b20d73f84f91e 100644 --- a/htdocs/fourn/commande/liste.php +++ b/htdocs/fourn/commande/liste.php @@ -105,16 +105,17 @@ } if ($sall) { - $sql.= " AND (cf.ref LIKE '%".$db->escape($sall)."%' OR cf.note LIKE '%".$db->escape($sall)."%')"; + $sql.= " AND (cf.ref LIKE '%".$db->escape($sall)."%' OR cf.note_private LIKE '%".$db->escape($sall)."%' OR cf.note_public LIKE '%".$db->escape($sall)."%')"; } if ($socid) $sql.= " AND s.rowid = ".$socid; if (GETPOST('statut')) { - $sql .= " AND fk_statut =".GETPOST('statut'); + $sql .= " AND fk_statut =".GETPOST('statut','int'); } -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); +$sql.= " ORDER BY $sortfield $sortorder "; +$sql.= $db->plimit($conf->liste_limit+1, $offset); $resql = $db->query($sql); if ($resql) From 8f1a5533951ccd7847252fa2f3315a836ecffbd6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 16:22:06 +0100 Subject: [PATCH 13/33] =?UTF-8?q?Fix:=20[=20bug=20#1162=20]=20Traduction?= =?UTF-8?q?=20des=20mi-journ=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 1 + htdocs/langs/en_US/main.lang | 2 ++ htdocs/langs/fr_FR/main.lang | 2 ++ 3 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1ea35d60a0ab9..375bd99b33814 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ Fix: [ bug #1145 ] Agenda button list type do not display Fix: [ bug #1148 ] Product consomation : supplier order bad status Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists Fix: [ bug #1163 ] SQL Error when searching for supplier orders +Fix: [ bug #1162 ] Traduction des mi-journées ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 6876d0c6b2b02..2bc80f696bd59 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -256,6 +256,8 @@ Seconds=Seconds Today=Today Yesterday=Yesterday Tomorrow=Tomorrow +Morning=Morning +Afternoon=Afternoon Quadri=Quadri MonthOfDay=Month of the day HourShort=H diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index f642fe4c9b5a8..9ad1a71b1a8dd 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -252,6 +252,8 @@ Seconds=Secondes Today=Aujourd'hui Yesterday=Hier Tomorrow=Demain +Morning=Matin +Afternoon=Après-midi Quadri=Trimestre MonthOfDay=Mois du jour HourShort=H From 84e345702378c617d6ce1ff9df6cdbe022ae5f7e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 16:30:35 +0100 Subject: [PATCH 14/33] Fix: [ bug #1161 ] Search on product label --- ChangeLog | 3 ++- htdocs/societe/consumption.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 375bd99b33814..6227e174763e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,7 +14,8 @@ Fix: [ bug #1145 ] Agenda button list type do not display Fix: [ bug #1148 ] Product consomation : supplier order bad status Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists Fix: [ bug #1163 ] SQL Error when searching for supplier orders -Fix: [ bug #1162 ] Traduction des mi-journées +Fix: [ bug #1162 ] Translaction for morning and afternoon +Fix: [ bug #1161 ] Search on product label ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 21d98fbd64c3a..16d2c4fea7d7a 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -214,6 +214,7 @@ $sql.= " AND ".$datePrint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; } if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'"; +if ($sprod_fulldescr) $sql.= " AND (d.description LIKE '%".$sprod_fulldescr."%' OR p.label LIKE '%".$sprod_fulldescr."%')"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); @@ -249,7 +250,7 @@ $formother->select_year($year?$year:-1,'year',1, 20, 1); print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; From eaa6d987b6012e7d45f924fa8146b9096d5e7172 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 17:32:05 +0100 Subject: [PATCH 15/33] Fix: When database is not synchronized with dir, we clean database. --- htdocs/ecm/ajax/ecmdatabase.php | 17 ++++++++++++++++- htdocs/ecm/class/ecmdirectory.class.php | 19 ++++++++++++------- htdocs/ecm/index.php | 21 ++++++++++++++++++--- htdocs/ecm/tpl/builddatabase.tpl.php | 21 +++++++++------------ 4 files changed, 55 insertions(+), 23 deletions(-) diff --git a/htdocs/ecm/ajax/ecmdatabase.php b/htdocs/ecm/ajax/ecmdatabase.php index cfdfb7fe26d19..7a1a667d33234 100644 --- a/htdocs/ecm/ajax/ecmdatabase.php +++ b/htdocs/ecm/ajax/ecmdatabase.php @@ -51,7 +51,9 @@ require DOL_DOCUMENT_ROOT . '/ecm/class/ecmdirectory.class.php'; $ecmdirstatic = new EcmDirectory($db); + $ecmdirtmp = new EcmDirectory($db); + // This part of code is same than into file index.php for action refreshmanual TODO Remove duplicate clearstatcache(); $diroutputslash=str_replace('\\', '/', $conf->$element->dir_output); @@ -129,7 +131,6 @@ if ($fk_parent >= 0) { - $ecmdirtmp=new EcmDirectory($db); $ecmdirtmp->ref = 'NOTUSEDYET'; $ecmdirtmp->label = dol_basename($dirdesc['fullname']); $ecmdirtmp->description = ''; @@ -163,7 +164,21 @@ } } + // Loop now on each sql tree to check if dir exists + foreach($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk + { + $dirtotest=$conf->$element->dir_output.'/'.$dirdesc['fullrelativename']; + if (! dol_is_dir($dirtotest)) + { + $mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."
\n"; + $ecmdirtmp->id=$dirdesc['id']; + $ecmdirtmp->delete($user,'databaseonly'); + //exit; + } + } + $sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" + dol_syslog("sql = ".$sql); $db->query($sql); } } diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 3c12fe066e974..ff914772b2f63 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -143,7 +143,7 @@ function create($user) $dir=$conf->ecm->dir_output.'/'.$this->getRelativePath(); $result=dol_mkdir($dir); if ($result < 0) { $error++; $this->error="ErrorFailedToCreateDir"; } - + // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); @@ -317,21 +317,23 @@ function fetch($id) /** - * Delete object on database and on disk + * Delete object on database and/or on disk * * @param User $user User that delete + * @param int $mode 'all'=delete all, 'databaseonly'=only database entry, 'fileonly' (not implemented) * @return int <0 if KO, >0 if OK */ - function delete($user) + function delete($user, $mode='all') { global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error=0; + $result=0; - $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3 + if ($mode != 'databaseonly') $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3 - dol_syslog(get_class($this)."::delete remove directory ".$relativepath); + dol_syslog(get_class($this)."::delete remove directory id=".$this->id." mode=".$mode.(($mode == 'databaseonly')?'':' relativepath='.$relativepath)); $this->db->begin(); @@ -348,8 +350,11 @@ function delete($user) return -2; } - $file = $conf->ecm->dir_output . "/" . $relativepath; - $result=@dol_delete_dir($file); + if ($mode != 'databaseonly') + { + $file = $conf->ecm->dir_output . "/" . $relativepath; + $result=@dol_delete_dir($file); + } if ($result || ! @is_dir(dol_osencode($file))) { diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index bb8844eafc692..0939dc9a77d49 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -201,7 +201,10 @@ // Refresh directory view if ($action == 'refreshmanual') { - clearstatcache(); + $ecmdirtmp = new EcmDirectory($db); + + // This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate + clearstatcache(); $diroutputslash=str_replace('\\','/',$conf->ecm->dir_output); $diroutputslash.='/'; @@ -264,7 +267,7 @@ //break; // We found parent, we can stop the while loop } else - { + { dol_syslog("No"); //print "No
\n"; } @@ -277,7 +280,6 @@ if ($fk_parent >= 0) { - $ecmdirtmp=new EcmDirectory($db); $ecmdirtmp->ref = 'NOTUSEDYET'; $ecmdirtmp->label = dol_basename($dirdesc['fullname']); $ecmdirtmp->description = ''; @@ -311,6 +313,19 @@ } } + // Loop now on each sql tree to check if dir exists + foreach($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk + { + $dirtotest=$conf->ecm->dir_output.'/'.$dirdesc['fullrelativename']; + if (! dol_is_dir($dirtotest)) + { + $mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."
\n"; + $ecmdirtmp->id=$dirdesc['id']; + $ecmdirtmp->delete($user,'databaseonly'); + //exit; + } + } + $sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" dol_syslog("sql = ".$sql); $db->query($sql); diff --git a/htdocs/ecm/tpl/builddatabase.tpl.php b/htdocs/ecm/tpl/builddatabase.tpl.php index 7f997ed62090e..38137fa49977a 100644 --- a/htdocs/ecm/tpl/builddatabase.tpl.php +++ b/htdocs/ecm/tpl/builddatabase.tpl.php @@ -39,7 +39,15 @@ function(file) { ); $('#refreshbutton').click( function() { - ecmBuildDatabase(); + $.pleaseBePatient("trans('PleaseBePatient'); ?>"); + $.getJSON( "", { + action: "build", + element: "ecm" + }, + function(response) { + $.unblockUI(); + location.href=""; + }); }); }); @@ -67,16 +75,5 @@ function loadandshowpreview(filedirname,section) }); } -ecmBuildDatabase = function() { - $.pleaseBePatient("trans('PleaseBePatient'); ?>"); - $.getJSON( "", { - action: "build", - element: "ecm" - }, - function(response) { - $.unblockUI(); - location.href=""; - }); -}; \ No newline at end of file From fdc12099860f65e258b29207704d0be353fc4289 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 18:12:15 +0100 Subject: [PATCH 16/33] Fix: [ bug #1163 ] SQL Error when searching for supplier orders Conflicts: ChangeLog --- ChangeLog | 1 - 1 file changed, 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6227e174763e2..46c847acadd07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,7 +46,6 @@ Fix: there was no escaping on filter fields in supplier product list Fix: bugs on margin reports and better margin calculation on credit notes Qual: Add travis-ci integration - ***** ChangeLog for 3.4 compared to 3.3.* ***** For users: - New: Can use ODS templates as document templates. From 2f88406677c94686040c8c607d5f4cb45d477ebc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 20:12:47 +0100 Subject: [PATCH 17/33] Fix: [ bug #1075 ] POS module doesn't decrement stock of products in Delayed payment mode. --- htdocs/cashdesk/validation_verif.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index 893768a9aecbf..3cd7784d59d40 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -212,7 +212,7 @@ $resultcreate=$invoice->create($user,0,dol_stringtotime($obj_facturation->paiementLe())); if ($resultcreate > 0) { - $resultvalid=$invoice->validate($user,$obj_facturation->numInvoice()); + $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), (isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0)); } else { From 131bbce6f3c60854368ee2b98214929e2e73fad1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 20:17:22 +0100 Subject: [PATCH 18/33] Update changelog --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 46c847acadd07..016dde9b28ad8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,7 +16,9 @@ Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists Fix: [ bug #1163 ] SQL Error when searching for supplier orders Fix: [ bug #1162 ] Translaction for morning and afternoon Fix: [ bug #1161 ] Search on product label - +Fix: [ bug #1075 ] POS module doesn't decrement stock of products in + delayed payment mode. + ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined Fix: Retrieving of margin info when invoice created automatically from order From c54c06e8d320bf6859aa4fe40397ae9b79c85924 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 21:03:12 +0100 Subject: [PATCH 19/33] Fix: [ bug #1171 ] Documents lost in interventions after validating --- htdocs/fichinter/class/fichinter.class.php | 68 +++++++++++++++++----- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 6e3079c6d7d2e..d2c379563c438 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -368,6 +368,7 @@ function setDraft($user) function setValid($user) { global $langs, $conf; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error=0; @@ -390,7 +391,7 @@ function setValid($user) $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter"; $sql.= " SET fk_statut = 1"; $sql.= ", ref = '".$num."'"; - $sql.= ", date_valid = ".$this->db->idate($now); + $sql.= ", date_valid = '".$this->db->idate($now)."'"; $sql.= ", fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; @@ -398,7 +399,52 @@ function setValid($user) dol_syslog(get_class($this)."::setValid sql=".$sql); $resql=$this->db->query($sql); - if ($resql) + if (! $resql) + { + dol_syslog(get_class($this)."::setValid Echec update - 10 - sql=".$sql, LOG_ERR); + dol_print_error($this->db); + $error++; + } + + if (! $error) + { + $this->oldref = ''; + + // Rename directory if dir was a temporary ref + if (preg_match('/^[\(]?PROV/i', $this->ref)) + { + // Rename of object directory ($this->ref = old ref, $num = new ref) + // to not lose the linked files + $oldref = dol_sanitizeFileName($this->ref); + $snum = dol_sanitizeFileName($num); + $dirsource = $conf->ficheinter->dir_output.'/'.$oldref; + $dirdest = $conf->ficheinter->dir_output.'/'.$snum; + if (file_exists($dirsource)) + { + dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest); + + if (@rename($dirsource, $dirdest)) + { + $this->oldref = $oldref; + + dol_syslog("Rename ok"); + // Suppression ancien fichier PDF dans nouveau rep + dol_delete_file($conf->ficheinter->dir_output.'/'.$snum.'/'.$oldref.'*.*'); + } + } + } + } + + // Set new ref and define current statut + if (! $error) + { + $this->ref = $num; + $this->statut=1; + $this->brouillon=0; + $this->date_validation=$now; + } + + if (! $error) { // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; @@ -408,24 +454,16 @@ function setValid($user) $error++; $this->errors=$interface->errors; } // Fin appel triggers + } - if (! $error) - { - $this->db->commit(); - return 1; - } - else - { - $this->db->rollback(); - $this->error=join(',',$this->errors); - dol_syslog(get_class($this)."::setValid ".$this->error,LOG_ERR); - return -1; - } + if (! $error) + { + $this->db->commit(); + return 1; } else { $this->db->rollback(); - $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::setValid ".$this->error,LOG_ERR); return -1; } From 4aea74d6fd7807a6154e1eb3dc9eac3897074489 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 21:05:22 +0100 Subject: [PATCH 20/33] Fix: [ bug #1171 ] Documents lost in interventions after validating --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 016dde9b28ad8..d2cad1045faf9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,7 +18,8 @@ Fix: [ bug #1162 ] Translaction for morning and afternoon Fix: [ bug #1161 ] Search on product label Fix: [ bug #1075 ] POS module doesn't decrement stock of products in delayed payment mode. - +Fix: [ bug #1171 ] Documents lost in interventions after validating + ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined Fix: Retrieving of margin info when invoice created automatically from order From c6991f97d40a3e710900dcb12bd9e06ef7e3f68c Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sun, 1 Dec 2013 22:47:22 +0100 Subject: [PATCH 21/33] [ bug #1174 ] Product translated description not good into PDF Country --- ChangeLog | 2 ++ htdocs/core/lib/pdf.lib.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f18248c35fc1f..f980c7fa7cf4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,8 @@ Fix: [ bug #1142 ] Set paiement on invoice (PGSql) Fix: [ bug #1145 ] Agenda button list type do not display Fix: [ bug #1148 ] Product consomation : supplier order bad status Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists +Fix: [ bug #1174 ] Product translated description not good into PDF + ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 5301f5daa0420..059cb0fe28527 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -923,7 +923,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (! empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang)) { if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"]; - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; + if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && strpos($desc,$prodser->description)!==false) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } } From ff9c84fd0e8fd6e1cd1939f77ad1a3145578e62a Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 2 Dec 2013 00:20:50 +0100 Subject: [PATCH 22/33] Better test for HTMLentities desc translation --- htdocs/core/lib/pdf.lib.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 059cb0fe28527..f11a0fa7ec851 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -923,7 +923,19 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (! empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang)) { if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"]; - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && strpos($desc,$prodser->description)!==false) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; + + //Manage HTML entities description test + if ($conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) { + $desctest=dol_htmlentities($desc, ENT_COMPAT | ENT_HTML401); + } else { + $desctest=$desc; + } + if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && + ((strpos($desctest,$prodser->description)!==false) || + (strpos($desc,$prodser->description)!==false))) { + $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; + } + if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } } From c0ef63fd746e99f31eb1870e5048108441d11c68 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 2 Dec 2013 00:22:49 +0100 Subject: [PATCH 23/33] Bteer fix --- htdocs/comm/propal.php | 4 ++-- htdocs/core/lib/pdf.lib.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 33fed6c76d181..60e29a74543f8 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -786,7 +786,7 @@ $info_bits=0; if ($tva_npr) $info_bits |= 0x01; - + if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').$langs->getCurrencySymbol($conf->currency)); @@ -920,7 +920,7 @@ $error++; } } - + if (! $error) { $result = $object->updateline( diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index f11a0fa7ec851..475991831e461 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -930,6 +930,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl } else { $desctest=$desc; } + //Test with htmlenties for update and no htmlentities for creation if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ((strpos($desctest,$prodser->description)!==false) || (strpos($desc,$prodser->description)!==false))) { From 1b38d36f2884a56e3e265f3cf6a1b099489d791f Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 2 Dec 2013 10:27:41 +0100 Subject: [PATCH 24/33] Better Fix --- htdocs/core/lib/pdf.lib.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 475991831e461..2bc5ebab1459b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -925,18 +925,14 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"]; //Manage HTML entities description test + //Cause $prodser->description is store with htmlentities but $desc no if ($conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) { - $desctest=dol_htmlentities($desc, ENT_COMPAT | ENT_HTML401); + $testDescNeedTranslated=(strpos(dol_html_entity_decode($desc,ENT_QUOTES | ENT_HTML401),dol_html_entity_decode($prodser->description,ENT_QUOTES | ENT_HTML401))!==false); } else { - $desctest=$desc; - } - //Test with htmlenties for update and no htmlentities for creation - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && - ((strpos($desctest,$prodser->description)!==false) || - (strpos($desc,$prodser->description)!==false))) { - $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; + $testDescNeedTranslated=true; } + if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($testDescNeedTranslated || (strpos($desc,$prodser->description)!==false))) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } } From 1ad1b25f6e6f19040d0eb559a6a8e2b312f5981f Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 2 Dec 2013 10:29:58 +0100 Subject: [PATCH 25/33] remove useless space --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 2bc5ebab1459b..dcf5ebff74b47 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -932,7 +932,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl $testDescNeedTranslated=true; } - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($testDescNeedTranslated || (strpos($desc,$prodser->description)!==false))) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; + if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($testDescNeedTranslated || (strpos($desc,$prodser->description)!==false))) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } } From 0907d81fcb816263ae2ddfc1b4b2179b492bde4a Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 2 Dec 2013 11:05:07 +0100 Subject: [PATCH 26/33] Avoid strpos bug if string is empty or null --- htdocs/core/lib/pdf.lib.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index dcf5ebff74b47..fdb07237bacb1 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -926,13 +926,21 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl //Manage HTML entities description test //Cause $prodser->description is store with htmlentities but $desc no + $testHTMLDescNeedTranslated=true; + $testDescNeedTranslated=true; if ($conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) { - $testDescNeedTranslated=(strpos(dol_html_entity_decode($desc,ENT_QUOTES | ENT_HTML401),dol_html_entity_decode($prodser->description,ENT_QUOTES | ENT_HTML401))!==false); + if (!empty($desc) && !empty($prodser->description)) { + $testHTMLDescNeedTranslated=(strpos(dol_html_entity_decode($desc,ENT_QUOTES | ENT_HTML401),dol_html_entity_decode($prodser->description,ENT_QUOTES | ENT_HTML401))!==false); + } } else { - $testDescNeedTranslated=true; + if (!empty($desc) && !empty($prodser->description)) { + $testDescNeedTranslated = (strpos($desc,$prodser->description)!==false); + } else { + $testDescNeedTranslated=false; + } } - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($testDescNeedTranslated || (strpos($desc,$prodser->description)!==false))) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; + if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($testHTMLDescNeedTranslated || $testDescNeedTranslated)) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } } From 3e712c9c8c8f33a80d74ab04e965394aeea5d7b3 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 2 Dec 2013 11:11:08 +0100 Subject: [PATCH 27/33] Finnaly make it works --- htdocs/core/lib/pdf.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index fdb07237bacb1..fa8de1c035290 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -932,6 +932,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (!empty($desc) && !empty($prodser->description)) { $testHTMLDescNeedTranslated=(strpos(dol_html_entity_decode($desc,ENT_QUOTES | ENT_HTML401),dol_html_entity_decode($prodser->description,ENT_QUOTES | ENT_HTML401))!==false); } + $testDescNeedTranslated=false; } else { if (!empty($desc) && !empty($prodser->description)) { $testDescNeedTranslated = (strpos($desc,$prodser->description)!==false); @@ -939,7 +940,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl $testDescNeedTranslated=false; } } - + if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($testHTMLDescNeedTranslated || $testDescNeedTranslated)) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } From bc4cfd66dbd13c12f498527dcba108dd7abb64a7 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 2 Dec 2013 15:07:34 +0100 Subject: [PATCH 28/33] Fix: fix unsubscribe URL into mailing when sending manually (not by script) --- ChangeLog | 1 + htdocs/comm/mailing/fiche.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e86e0f72799d..d6caeca60c38f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,7 @@ Fix: [ bug #1162 ] Translaction for morning and afternoon Fix: [ bug #1161 ] Search on product label Fix: [ bug #1075 ] POS module doesn't decrement stock of products in delayed payment mode. Fix: [ bug #1171 ] Documents lost in interventions after validating +Fix: fix unsubscribe URL into mailing when sending manually (not by script) ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 88ee011bf8f7a..c3f87e6e4e8cd 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -221,8 +221,8 @@ $substitutionarray=array( '__ID__' => $obj->source_id, '__EMAIL__' => $obj->email, - '__CHECK_READ__' => '', - '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', + '__CHECK_READ__' => '', + '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', '__MAILTOEMAIL__' => ''.$obj->email.'', '__LASTNAME__' => $obj->lastname, '__FIRSTNAME__' => $obj->firstname, From c2a8967b52cf3b154be7d35fdec1eaa427156111 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 3 Dec 2013 17:06:19 +0100 Subject: [PATCH 29/33] Much better fix for translated product description into PDF --- htdocs/core/lib/pdf.lib.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index fa8de1c035290..1f5ef92f711be 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -926,22 +926,14 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl //Manage HTML entities description test //Cause $prodser->description is store with htmlentities but $desc no - $testHTMLDescNeedTranslated=true; - $testDescNeedTranslated=true; - if ($conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) { - if (!empty($desc) && !empty($prodser->description)) { - $testHTMLDescNeedTranslated=(strpos(dol_html_entity_decode($desc,ENT_QUOTES | ENT_HTML401),dol_html_entity_decode($prodser->description,ENT_QUOTES | ENT_HTML401))!==false); - } - $testDescNeedTranslated=false; + $needdesctranslation=false; + if (!empty($desc) && dol_textishtml($desc) && !empty($prodser->description) && dol_textishtml($prodser->description)) { + $needdesctranslation=(strpos(dol_html_entity_decode($desc,ENT_QUOTES | ENT_HTML401),dol_html_entity_decode($prodser->description,ENT_QUOTES | ENT_HTML401))!==false); } else { - if (!empty($desc) && !empty($prodser->description)) { - $testDescNeedTranslated = (strpos($desc,$prodser->description)!==false); - } else { - $testDescNeedTranslated=false; - } + $needdesctranslation=($desc == $prodser->description); } - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($testHTMLDescNeedTranslated || $testDescNeedTranslated)) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; + if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($needdesctranslation)) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } } From 73e60e0629c4af5da868ec4e1c19b6ba7e6b4bd3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2013 12:06:41 +0100 Subject: [PATCH 30/33] Fix: Mass update of vat must work also for supplier prices Conflicts: htdocs/product/admin/product_tools.php --- htdocs/product/admin/product_tools.php | 201 +++++++++++++++++-------- 1 file changed, 138 insertions(+), 63 deletions(-) diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index e3ba408bc16d2..c32cfd53ad4b5 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013 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 @@ -28,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $langs->load("admin"); $langs->load("products"); @@ -41,6 +43,7 @@ //$price_base_type=GETPOST('price_base_type'); $objectstatic = new Product($db); +$objectstatic2 = new ProductFournisseur($db); /* @@ -60,104 +63,176 @@ if (! $error) { - $db->begin(); + $country_id=$mysoc->country_id; // TODO Allow to choose country into form - $sql = 'SELECT rowid'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'product'; - $sql.= ' WHERE entity IN ('.getEntity('product',1).')'; - $sql.= " AND tva_tx = '".$db->escape($oldvatrate)."'"; - //$sql.= ' AND price_base_type = "'..'"'; - //print $sql; + $nbrecordsmodified=0; - $resql=$db->query($sql); - if ($resql) + $db->begin(); + + // If country to edit is my country, so we change customer prices + if ($country_id == $mysoc->country_id) { - $num = $db->num_rows($resql); + $sql = 'SELECT rowid'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'product'; + $sql.= ' WHERE entity IN ('.getEntity('product',1).')'; + $sql.= " AND tva_tx = '".$db->escape($oldvatrate)."'"; - $i = 0; $nbrecordsmodified=0; - while ($i < $num) + $resql=$db->query($sql); + if ($resql) { - $obj = $db->fetch_object($resql); + $num = $db->num_rows($resql); - $ret=$objectstatic->fetch($obj->rowid); - if ($ret > 0) + $i = 0; + while ($i < $num) { - $ret=0; $retm=0; $updatelevel1=false; + $obj = $db->fetch_object($resql); - // Update multiprice - $listofmulti=array_reverse($objectstatic->multiprices, true); // To finish with level 1 - foreach ($listofmulti as $level => $multiprices) + $ret=$objectstatic->fetch($obj->rowid); + if ($ret > 0) { - $price_base_type = $objectstatic->multiprices_base_type[$level]; // Get price_base_type of product/service to keep the same for update - if (empty($price_base_type)) continue; // Discard not defined price levels + $ret=0; $retm=0; $updatelevel1=false; + + // Update multiprice + $listofmulti=array_reverse($objectstatic->multiprices, true); // To finish with level 1 + foreach ($listofmulti as $level => $multiprices) + { + $price_base_type = $objectstatic->multiprices_base_type[$level]; // Get price_base_type of product/service to keep the same for update + if (empty($price_base_type)) continue; // Discard not defined price levels + + if ($price_base_type == 'TTC') + { + $newprice=price2num($objectstatic->multiprices_ttc[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->multiprices_min_ttc[$level]; + } + else + { + $newprice=price2num($objectstatic->multiprices[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->multiprices_min[$level]; + } + if ($newminprice > $newprice) $newminprice=$newprice; + $newvat=str_replace('*','',$newvatrate); + $newnpr=$objectstatic->multiprices_recuperableonly[$level]; + $newlevel=$level; + + //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $retm=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + if ($retm < 0) + { + $error++; + break; + } + + if ($newlevel == 1) $updatelevel1=true; + } + // Update single price + $price_base_type = $objectstatic->price_base_type; // Get price_base_type of product/service to keep the same for update if ($price_base_type == 'TTC') { - $newprice=price2num($objectstatic->multiprices_ttc[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->multiprices_min_ttc[$level]; + $newprice=price2num($objectstatic->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->price_min_ttc; } else { - $newprice=price2num($objectstatic->multiprices[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->multiprices_min[$level]; + $newprice=price2num($objectstatic->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->price_min; } if ($newminprice > $newprice) $newminprice=$newprice; $newvat=str_replace('*','',$newvatrate); - $newnpr=$objectstatic->multiprices_recuperableonly[$level]; - $newlevel=$level; - - //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $retm=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); - if ($retm < 0) + $newnpr=$objectstatic->recuperableonly; + $newlevel=0; + if (! empty($price_base_type) && ! $updatelevel1) { - $error++; - break; + //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $ret=$objectstatic->updatePrice($objectstatic->id,$newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); } - if ($newlevel == 1) $updatelevel1=true; + if ($ret < 0 || $retm < 0) $error++; + else $nbrecordsmodified++; } - // Update single price - $price_base_type = $objectstatic->price_base_type; // Get price_base_type of product/service to keep the same for update - if ($price_base_type == 'TTC') - { - $newprice=price2num($objectstatic->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->price_min_ttc; - } - else - { - $newprice=price2num($objectstatic->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->price_min; - } - if ($newminprice > $newprice) $newminprice=$newprice; + $i++; + } + } + else dol_print_error($db); + } + + $fourn = new Fournisseur($db); + + // Change supplier prices + $sql = 'SELECT pfp.rowid, pfp.fk_soc, pfp.price as price, pfp.quantity as qty, pfp.fk_availability, pfp.ref_fourn'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp, '.MAIN_DB_PREFIX.'societe as s'; + $sql.= ' WHERE pfp.fk_soc = s.rowid AND pfp.entity IN ('.getEntity('product',1).')'; + $sql.= " AND tva_tx = '".$db->escape($oldvatrate)."'"; + $sql.= " AND s.fk_pays = '".$country_id."'"; + //print $sql; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + $ret=$objectstatic2->fetch_product_fournisseur_price($obj->rowid); + if ($ret > 0) + { + $ret=0; $retm=0; $updatelevel1=false; + + $price_base_type='HT'; + //$price_base_type = $objectstatic2->price_base_type; // Get price_base_type of product/service to keep the same for update + //if ($price_base_type == 'TTC') + //{ + // $newprice=price2num($objectstatic2->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + // $newminprice=$objectstatic2->price_min_ttc; + //} + //else + //{ + $newprice=price2num($obj->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + //$newminprice=$objectstatic2->fourn_price_min; + //} + //if ($newminprice > $newprice) $newminprice=$newprice; $newvat=str_replace('*','',$newvatrate); - $newnpr=$objectstatic->recuperableonly; + //$newnpr=$objectstatic2->recuperableonly; $newlevel=0; if (! empty($price_base_type) && ! $updatelevel1) { - //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $ret=$objectstatic->updatePrice($objectstatic->id,$newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + //print "$objectstatic2->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $fourn->id=$obj->fk_soc; + $ret=$objectstatic2->update_buyprice($obj->qty, $newprice, $user, $price_base_type, $fourn, $obj->fk_availability, $obj->ref_fourn, $newvat); } if ($ret < 0 || $retm < 0) $error++; else $nbrecordsmodified++; } - $i++; } + } + else dol_print_error($db); - if (! $error) - { - if ($nbrecordsmodified > 0) setEventMessage($langs->trans("RecordsModified",$nbrecordsmodified)); - else setEventMessage($langs->trans("NoRecordFound"),'warnings'); - $db->commit(); - } - else - { - setEventMessage($langs->trans("Error"),'errors'); - $db->rollback(); - } + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } + + // Output result + if (! $error) + { + if ($nbrecordsmodified > 0) setEventMessage($langs->trans("RecordsModified",$nbrecordsmodified)); + else setEventMessage($langs->trans("NoRecordFound"),'warnings'); } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } + } } From b637b28c8b5f086b9a6586f3e15c24c10b565e84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2013 18:47:58 +0100 Subject: [PATCH 31/33] Update ignore files --- htdocs/.gitignore | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/.gitignore b/htdocs/.gitignore index bc4b1c974aeb4..a4ebd2bb7c796 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -1,9 +1,11 @@ /test.php /custom* -/bootstrap -/multicompany -/ovh -/numberingpack -/google -/skincoloreditor +/extensions* +/nltechno* +/bootstrap* +/google* +/multicompany* +/numberingpack* +/ovh* /pos +/ultimatepdf* From beb93e9245c661c41393d0fcdc926130ab556562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 8 Dec 2013 20:23:44 +0200 Subject: [PATCH 32/33] Resolved bug #1182: ODT company_country tag is htmlencoded --- ChangeLog | 1 + htdocs/societe/class/societe.class.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d6caeca60c38f..2fcf861008b30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ Fix: [ bug #1161 ] Search on product label Fix: [ bug #1075 ] POS module doesn't decrement stock of products in delayed payment mode. Fix: [ bug #1171 ] Documents lost in interventions after validating Fix: fix unsubscribe URL into mailing when sending manually (not by script) +Fix: [ bug #1182 ] ODT company_country tag is htmlencoded ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 80b65229f6835..f37d7c25fa065 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -768,7 +768,7 @@ function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2=' $this->country_id = $obj->country_id; $this->country_code = $obj->country_id?$obj->country_code:''; - $this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->trans('Country'.$obj->country_code):$obj->country):''; + $this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):''; $this->state_id = $obj->fk_departement; $this->state_code = $obj->state_code; From 825640d645a6ee4432cebdee0e5a40df8122dcac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Dec 2013 21:24:59 +0100 Subject: [PATCH 33/33] Fix: Missing special code into export --- htdocs/core/modules/modFacture.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 9c91e0fc3b26e..8f25ceb594004 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -174,10 +174,10 @@ function __construct($db) $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("facture","facture","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','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','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); + $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','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','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT ';