Skip to content

Commit

Permalink
Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 22, 2017
2 parents b3d1cdf + 206d46c commit 30c39d2
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 46 deletions.
8 changes: 5 additions & 3 deletions build/perl/virtualmin/README
@@ -1,8 +1,10 @@
README (English)
##################################################
Install script for Virtualmin Pro
Install script for Virtualmin Professional / GPL
##################################################

This script will install automatically Dolibarr from Virtualmin Pro
http://www.virtualmin.com
This script will install automatically Dolibarr from Virtualmin.
(Included in the professional version and can be added in the GPL version)

https://www.virtualmin.com
http://www.webmin.com/virtualmin.html
43 changes: 24 additions & 19 deletions build/perl/virtualmin/dolibarr.pl
@@ -1,7 +1,7 @@
#----------------------------------------------------------------------------
# \file dolibarr.pl
# \brief Dolibarr script install for Virtualmin Pro
# \author (c)2009-2015 Regis Houssin <regis.houssin@capnetworks.com>
# \author (c)2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
#----------------------------------------------------------------------------


Expand Down Expand Up @@ -30,7 +30,12 @@ sub script_dolibarr_author
# script_dolibarr_versions()
sub script_dolibarr_versions
{
return ( "3.8.1", "3.7.1", "3.6.4", "3.5.7" );
return ( "5.0.4", "4.0.6", "3.9.4" );
}

sub script_dolibarr_release
{
return 2; # for mysqli fix
}

sub script_dolibarr_category
Expand Down Expand Up @@ -177,9 +182,9 @@ sub script_dolibarr_install
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" && $version >= 3.6 ? "mysql" :
local $dbphptype = $dbtype eq "mysql" && $version < 3.6 ? "mysql" :
$dbtype eq "mysql" ? "mysqli" : "pgsql";
local $dbhost = &get_database_host($dbtype);
local $dbhost = &get_database_host($dbtype, $d);
local $dberr = &check_script_db_connection($dbtype, $dbname, $dbuser, $dbpass);
return (0, "Database connection failed : $dberr") if ($dberr);

Expand All @@ -206,9 +211,6 @@ sub script_dolibarr_install
$charset = $dbtype eq "mysql" ? $mycharset : $pgcharset;
$collate = $dbtype eq "mysql" ? $mycollate : "C";

# Install filename
local $step = $version >= 3.8 ? "step" : "etape";

$path = &script_path_url($d, $opts);
if ($path =~ /^https:/ || $d->{'ssl'}) {
$url = "https://$d->{'dom'}";
Expand All @@ -222,15 +224,11 @@ sub script_dolibarr_install

if (!$upgrade) {
local $cdef = "$opts->{'dir'}/conf/conf.php.example";
&run_as_domain_user($d, "cp ".quotemeta($cdef)." ".quotemeta($cfile));
&copy_source_dest_as_domain_user($d, $cdef, $cfile);
&set_permissions_as_domain_user($d, 0777, $cfiledir);
&set_permissions_as_domain_user($d, 0666, $cfile);
&copy_source_dest_as_domain_user($d, $cfile);
&run_as_domain_user($d, "mkdir ".quotemeta($docdir));
&set_permissions_as_domain_user($d, 0777, $docdir);
if (!$version >= 3.7.2) {
&run_as_domain_user($d, "mkdir ".quotemeta($altdir));
&set_permissions_as_domain_user($d, 0777, $altdir);
}
}
else {
# Preserve old config file, documents and custom directory
Expand Down Expand Up @@ -266,7 +264,8 @@ sub script_dolibarr_install
[ "versionfrom", $upgrade->{'version'} ],
[ "versionto", $ver ],
);
local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts);
local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);

# Remove the installation directory.
Expand All @@ -289,15 +288,17 @@ sub script_dolibarr_install
[ "main_force_https", $opts->{'forcehttps'} ],
[ "dolibarr_main_db_character_set", $charset ],
[ "dolibarr_main_db_collation", $collate ],
[ "main_use_alt_dir", "1" ],
[ "usealternaterootdir", "1" ],
[ "main_alt_dir_name", "custom" ],
);
local $err = &call_dolibarr_wizard_page(\@params, $step."1", $d, $opts);
local $p = $ver >= 3.8 ? "step1" : "etape1";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);

# Second page (Populate database)
local @params = ( [ "action", "set" ] );
local $err = &call_dolibarr_wizard_page(\@params, $step."2", $d, $opts);
local $p = $ver >= 3.8 ? "step2" : "etape2";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);

# Third page (Add administrator account)
Expand All @@ -306,7 +307,8 @@ sub script_dolibarr_install
[ "pass", $dompass ],
[ "pass_verif", $dompass ],
);
local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts);
local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);

# Remove the installation directory and protect config file.
Expand Down Expand Up @@ -384,7 +386,10 @@ sub script_dolibarr_check_latest
{
local ($ver) = @_;
local @vers = &osdn_package_versions("dolibarr",
$ver >= 3.8 ? "dolibarr\\-(3\\.[0-9\\.]+)\\.tgz" :
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 4.0 ? "dolibarr\\-(4\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.9 ? "dolibarr\\-(3\\.9\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.8 ? "dolibarr\\-(3\\.8\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.7 ? "dolibarr\\-(3\\.7\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.6 ? "dolibarr\\-(3\\.6\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.5 ? "dolibarr\\-(3\\.5\\.[0-9\\.]+)\\.tgz" :
Expand Down
34 changes: 22 additions & 12 deletions htdocs/core/class/commondocgenerator.class.php
Expand Up @@ -374,13 +374,12 @@ function get_substitutionarray_object($object,$outputlangs,$array_key='object')
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
$array_key.'_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
$array_key.'_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),

$array_key.'_total_ht'=>price2num($object->total_ht),
$array_key.'_total_vat'=>(! empty($object->total_vat)?price2num($object->total_vat):price2num($object->total_tva)),
$array_key.'_total_localtax1'=>price2num($object->total_localtax1),
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
$array_key.'_total_ttc'=>price2num($object->total_ttc),
$array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()),

$array_key.'_multicurrency_code' => price2num($object->multicurrency_code),
$array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx),
Expand Down Expand Up @@ -411,18 +410,29 @@ function get_substitutionarray_object($object,$outputlangs,$array_key='object')
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT')
);

if (method_exists($object, 'getTotalDiscount')) {
$resarray[$array_key.'_total_discount_ht_locale'] = price($object->getTotalDiscount(), 0, $outputlangs);
$resarray[$array_key.'_total_discount_ht'] = price2num($object->getTotalDiscount());
} else {
$resarray[$array_key.'_total_discount_ht_locale'] = '';
$resarray[$array_key.'_total_discount_ht'] = '';
}

// Add vat by rates
foreach ($object->lines as $line)
if (is_array($object->lines) && count($object->lines)>0)
{
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
// $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
$vatformated=vatrate($line->tva_tx);
if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0;
$resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]);
foreach ($object->lines as $line)
{
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
// $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
$vatformated=vatrate($line->tva_tx);
if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0;
$resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]);
}
}
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options))
Expand Down
6 changes: 3 additions & 3 deletions htdocs/expedition/card.php
Expand Up @@ -765,7 +765,7 @@
print "<tr><td>".$langs->trans("DeliveryMethod")."</td>";
print '<td colspan="3">';
$expe->fetch_delivery_methods();
print $form->selectarray("shipping_method_id",$expe->meths,GETPOST('shipping_method_id','int'),1,0,0,"",1);
print $form->selectarray("shipping_method_id", $expe->meths, GETPOST('shipping_method_id','int'),1,0,0,"",1);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print "</td></tr>\n";

Expand All @@ -777,11 +777,11 @@

// Other attributes
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $expe->showOptionals($extrafields, 'edit');
print $object->showOptionals($extrafields, 'edit');
}


Expand Down
2 changes: 1 addition & 1 deletion htdocs/fourn/card.php
Expand Up @@ -66,7 +66,7 @@
* Action
*/

$parameters=array('socid'=>$socid);
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

Expand Down
7 changes: 4 additions & 3 deletions htdocs/fourn/class/fournisseur.product.class.php
Expand Up @@ -588,7 +588,8 @@ function find_min_price_product_fournisseur($prodid, $qty=0, $socid=0)
foreach($record_array as $record)
{
$fourn_price = $record["price"];
$fourn_unitprice = $record["unitprice"];
// discount calculated buy price
$fourn_unitprice = $record["unitprice"] * (1 - $record["remise_percent"] / 100) + $record["unitcharges"] - $record["remise"];
if (!empty($conf->dynamicprices->enabled) && !empty($record["fk_supplier_price_expression"])) {
$prod_supplier = new ProductFournisseur($this->db);
$prod_supplier->product_fourn_price_id = $record["product_fourn_price_id"];
Expand Down Expand Up @@ -620,7 +621,7 @@ function find_min_price_product_fournisseur($prodid, $qty=0, $socid=0)
$this->fourn_qty = $record["quantity"];
$this->fourn_remise_percent = $record["remise_percent"];
$this->fourn_remise = $record["remise"];
$this->fourn_unitprice = $fourn_unitprice;
$this->fourn_unitprice = $record["unitprice"];
$this->fourn_charges = $record["charges"]; // deprecated
$this->fourn_unitcharges = $record["unitcharges"]; // deprecated
$this->fourn_tva_tx = $record["tva_tx"];
Expand All @@ -629,7 +630,7 @@ function find_min_price_product_fournisseur($prodid, $qty=0, $socid=0)
$this->delivery_time_days = $record["delivery_time_days"];
$this->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
$this->id = $prodid;
$min = $this->fourn_unitprice;
$min = $fourn_unitprice;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions htdocs/install/mysql/migration/3.9.0-4.0.0.sql
Expand Up @@ -34,6 +34,7 @@ ALTER TABLE llx_product_customer_price ADD COLUMN localtax1_type varchar(10) NO
ALTER TABLE llx_product_customer_price ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx;
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
ALTER TABLE llx_supplier_proposaldet CHANGE COLUMN fk_askpricesupplier fk_supplier_proposal integer NOT NULL;

ALTER TABLE llx_opensurvey_sondage ADD COLUMN status integer DEFAULT 1 after date_fin;

Expand Down
13 changes: 8 additions & 5 deletions scripts/cron/cron_run_jobs.php
Expand Up @@ -55,10 +55,10 @@
if (! isset($argv[2]) || ! $argv[2]) {
usage($path,$script_file);
exit(-1);
} else {
$userlogin=$argv[2];
}

$userlogin=$argv[2];


// Global variables
$version=DOL_VERSION;
Expand All @@ -69,8 +69,11 @@
* Main
*/

// current date
$now=dol_now();

@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." ***** userlogin=" . $userlogin . " ***** " . $now . " *****\n";

// Check security key
if ($key != $conf->global->CRON_KEY)
Expand Down Expand Up @@ -114,6 +117,7 @@
exit(-1);
}
}
$user->getrights();

if (isset($argv[3]) || $argv[3])
{
Expand All @@ -136,6 +140,7 @@
exit(-1);
}


$qualifiedjobs = array();
foreach($object->lines as $val)
{
Expand All @@ -145,8 +150,6 @@

// TODO This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page.

// current date
$now=dol_now();
$nbofjobs=count($qualifiedjobs);
$nbofjobslaunchedok=0;
$nbofjobslaunchedko=0;
Expand Down

0 comments on commit 30c39d2

Please sign in to comment.