From 94ac0f53057143f925033e9054faabac536663b0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 9 Aug 2015 13:25:09 +0200 Subject: [PATCH 1/3] Fix: remove custom dir creation --- build/perl/virtualmin/dolibarr.pl | 52 +++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl index f105a89bc4d..a8241055d0f 100644 --- a/build/perl/virtualmin/dolibarr.pl +++ b/build/perl/virtualmin/dolibarr.pl @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------- # \file dolibarr.pl # \brief Dolibarr script install for Virtualmin Pro -# \author (c)2009-2012 Regis Houssin +# \author (c)2009-2015 Regis Houssin #---------------------------------------------------------------------------- @@ -30,8 +30,7 @@ return "Regis Houssin"; # script_dolibarr_versions() sub script_dolibarr_versions { - # TODO Replace this with version of Dolibar we want to install - return ( "x.y.z", "3.6.0"); +return ( "3.7.2", "3.6.3", "3.5.6" ); } sub script_dolibarr_category @@ -57,6 +56,26 @@ local ($d, $ver) = @_; return ("mysql", "postgres"); } +# script_dolibarr_depends(&domain, version) +sub script_dolibarr_depends +{ +local ($d, $ver, $sinfo, $phpver) = @_; +local @rv; + +if ($ver >= 3.6) { + # Check for PHP 5.3+ + local $phpv = &get_php_version($phpver || 5, $d); + if (!$phpv) { + push(@rv, "Could not work out exact PHP version"); + } + elsif ($phpv < 5.3) { + push(@rv, "Dolibarr requires PHP version 5.3 or later"); + } + } + +return @rv; +} + # script_dolibarr_params(&domain, version, &upgrade-info) # Returns HTML for table rows for options for installing dolibarr sub script_dolibarr_params @@ -78,8 +97,7 @@ else { $rv .= &ui_table_row("Database for Dolibarr tables", &ui_database_select("db", undef, \@dbs, $d, "dolibarr")); $rv .= &ui_table_row("Install sub-directory under $hdir", - &ui_opt_textbox("dir", "dolibarr", 30, - "At top level")); + &ui_opt_textbox("dir", &substitute_scriptname_template("dolibarr", $d), 30, "At top level")); if ($d->{'ssl'} && $ver >= 3.0) { $rv .= &ui_table_row("Force https connection?", &ui_yesno_radio("forcehttps", 0)); @@ -159,7 +177,8 @@ if ($opts->{'newdb'} && !$upgrade) { local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2); local $dbuser = $dbtype eq "mysql" ? &mysql_user($d) : &postgres_user($d); local $dbpass = $dbtype eq "mysql" ? &mysql_pass($d) : &postgres_pass($d, 1); -local $dbphptype = $dbtype eq "mysql" ? "mysqli" : "pgsql"; +local $dbphptype = $dbtype eq "mysql" && $version >= 3.6 ? "mysql" : + $dbtype eq "mysql" ? "mysqli" : "pgsql"; local $dbhost = &get_database_host($dbtype); local $dberr = &check_script_db_connection($dbtype, $dbname, $dbuser, $dbpass); return (0, "Database connection failed : $dberr") if ($dberr); @@ -201,12 +220,10 @@ if ($opts->{'path'} =~ /\w/) { if (!$upgrade) { local $cdef = "$opts->{'dir'}/conf/conf.php.example"; &run_as_domain_user($d, "cp ".quotemeta($cdef)." ".quotemeta($cfile)); - &set_ownership_permissions(undef, undef, 0777, $cfiledir); - &set_ownership_permissions(undef, undef, 0666, $cfile); + &set_permissions_as_domain_user($d, 0777, $cfiledir); + &set_permissions_as_domain_user($d, 0666, $cfile); &run_as_domain_user($d, "mkdir ".quotemeta($docdir)); - &set_ownership_permissions(undef, undef, 0777, $docdir); - &run_as_domain_user($d, "mkdir ".quotemeta($altdir)); - &set_ownership_permissions(undef, undef, 0777, $altdir); + &set_permissions_as_domain_user($d, 0777, $docdir); } else { # Preserve old config file, documents and custom directory @@ -289,8 +306,8 @@ else { local $dinstall = "$opts->{'dir'}/install"; $dinstall =~ s/\/$//; $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); - &set_ownership_permissions(undef, undef, 0644, $cfile); - &set_ownership_permissions(undef, undef, 0755, $cfiledir); + &set_permissions_as_domain_user($d, 0644, $cfile); + &set_permissions_as_domain_user($d, 0755, $cfiledir); } # Return a URL for the user @@ -309,6 +326,7 @@ local $ipage = $opts->{'path'}."/install/".$page.".php"; local ($iout, $ierror); &post_http_connection($d, $ipage, $params, \$iout, \$ierror); +print STDERR $iout; if ($ierror) { return $ierror; @@ -329,10 +347,10 @@ local $derr = &delete_script_install_directory($d, $opts); return (0, $derr) if ($derr); # Remove all llx_ tables from the database -# 3 times because of constraints -&cleanup_script_database($d, $opts->{'db'}, "llx_"); -&cleanup_script_database($d, $opts->{'db'}, "llx_"); -&cleanup_script_database($d, $opts->{'db'}, "llx_"); +# 4 times because of constraints +for(my $i=0; $i<4; $i++) { + &cleanup_script_database($d, $opts->{'db'}, "llx_"); + } # Take out the DB if ($opts->{'newdb'}) { From 2f921b643119158db9330afaeb8274c805378cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 9 Aug 2015 13:46:48 +0200 Subject: [PATCH 2/3] Fix [ bug #3342 ]: Taxes dictionary page does not accept localized decimals for localtax2 rate Close #3342 --- ChangeLog | 1 + htdocs/admin/dict.php | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1394e58a1f3..5eee4306ba6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,6 +41,7 @@ English Dolibarr ChangeLog - Fix: [ bug #2696 ] Adding complementary attribute fails if code is numerics - Fix: [ bug #3074 ] Accruals accounting use payment date instead of commitment date in turnover reports for salaries - Fix: Not showing product supplier reference when page break +- Fix: [ bug #3342 ] Taxes dictionary page does not accept localized decimals for localtax2 rate ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 4a4e66e4ea5..38f991faf52 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -516,7 +516,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $i=0; foreach ($listfieldinsert as $f => $value) { - if ($value == 'price' || preg_match('/^amount/i',$value)) { + if ($value == 'price' || preg_match('/^amount/i',$value) || preg_match('/^localtax/i',$value) || $value == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } else if ($value == 'entity') { @@ -564,7 +564,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $i = 0; foreach ($listfieldmodify as $field) { - if ($field == 'price' || preg_match('/^amount/i',$field)) { + if ($field == 'price' || preg_match('/^amount/i',$field) || preg_match('/^localtax/i',$field) || $field == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } else if ($field == 'entity') { @@ -1080,17 +1080,20 @@ if ($id) $align="center"; } else if ($fieldlist[$field]=='localtax1') { + $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); if ($obj->localtax1 == 0) $valuetoshow = ''; $align="right"; } else if ($fieldlist[$field]=='localtax2') { + $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); if ($obj->localtax2 == 0) $valuetoshow = ''; $align="right"; } else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) { + $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); $align="right"; } else if (in_array($fieldlist[$field],array('recuperableonly'))) From 8a1c5450c2b74952ae8f156d211a55b3e9f273c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 9 Aug 2015 18:26:12 +0200 Subject: [PATCH 3/3] Fixed minor problem with error alert when creating user --- htdocs/user/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 563dbece92d..737af4baa27 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -255,7 +255,7 @@ if ($action == 'add' && $canadduser) $langs->load("errors"); $db->rollback(); if (is_array($object->errors) && count($object->errors)) setEventMessage($object->errors,'errors'); - else setEventMessage($object->error); + else setEventMessage($object->error, 'errors'); $action="create"; // Go back to create page } @@ -320,7 +320,7 @@ if ($action == 'update' && ! $_POST["cancel"]) $result=$tmpuser->fetch(0, GETPOST("login")); if ($result > 0) { - setEventMessage($langs->trans("ErrorLoginAlreadyExists"), 'errors'); + setEventMessage($langs->trans("ErrorLoginAlreadyExists", GETPOST('login')), 'errors'); $action="edit"; // Go back to create page $error++; }