diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index 4f3d45294a9..ea4bbf97af0 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -35,7 +35,10 @@ if (!$user->admin) $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); -$arrayofparameters=array('DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200')); +$arrayofparameters=array( + 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), + 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) +); /* @@ -76,6 +79,8 @@ if ($action == 'edit') foreach($arrayofparameters as $key => $val) { + if (isset($val['enabled']) && empty($val['enabled'])) continue; + print ''; print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print ''; diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 07dbec4b902..99f67f152ef 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -43,18 +43,18 @@ class Dolistore /** * Constructor */ - function __construct() + function __construct($debug=false) { global $conf, $langs; $this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace'; $this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product='; $this->vat_rate = 1.2; // 20% de TVA - $this->debug_api = false; + $this->debug_api = $debug; $langtmp = explode('_', $langs->defaultlang); $lang = $langtmp[0]; - $lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1 + $lang_array = array('en'=>1, 'fr'=>2, 'es'=>3, 'it'=>4, 'de'=>5); // Into table ps_lang of Prestashop - 1 if (! in_array($lang, array_keys($lang_array))) $lang = 'en'; $this->lang = $lang_array[$lang]; } @@ -81,8 +81,9 @@ class Dolistore } try { - $this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, - $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api); + $this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api); + dol_syslog("Call API with MAIN_MODULE_DOLISTORE_API_SRV = ".$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); + // $conf->global->MAIN_MODULE_DOLISTORE_API_KEY is for the login of basic auth. There is no password as it is public data. // Here we set the option array for the Webservice : we want products resources $opt = array(); @@ -92,7 +93,13 @@ class Dolistore if ($this->search != '') { $opt2 = array(); $opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang; + // Call + //var_dump($this->api); + + dol_syslog("Call API with opt = ".var_export($opt, true)); + dol_syslog("Call API with opt2 = ".var_export($opt2, true)); + $xml = $this->api->get($opt2); $products = array(); foreach ($xml->products->children() as $product) { @@ -117,7 +124,10 @@ class Dolistore $opt['limit'] = "$this->start,$this->end"; // $opt['filter[id]'] contais list of product id that are result of search + // Call API to get the detail + dol_syslog("Call API with opt = ".var_export($opt, true)); + dol_syslog("Call API with opt2 = ".var_export($opt2, true)); $xml = $this->api->get($opt); $this->products = $xml->products->children(); @@ -135,7 +145,11 @@ class Dolistore $trace = $e->getTrace(); if ($trace[0]['args'][0] == 404) die('Bad ID'); else if ($trace[0]['args'][0] == 401) die('Bad auth key'); - else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); + else + { + print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'
'; + print $e->getMessage(); + } } } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 036e6100449..cb560b29d86 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -56,7 +56,7 @@ $options['categorie'] = ((GETPOST('categorie', 'int')?GETPOST('categorie', 'int' $options['start'] = ((GETPOST('start', 'int')?GETPOST('start', 'int'):0) + 0); $options['end'] = ((GETPOST('end', 'int')?GETPOST('end', 'int'):0) + 0); $options['search'] = GETPOST('search_keyword', 'alpha'); -$dolistore = new Dolistore(); +$dolistore = new Dolistore(false); if (! $user->admin) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 09a528b1ce7..59a901ccdf8 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -234,7 +234,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $sql.= ", s.nom as name"; $sql.= ", s.rowid as socid, s.email"; $sql.= ", s.code_fournisseur, s.code_compta_fournisseur"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s"; + $sql.= ", cc.rowid as country_id, cc.code as country_code"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.rowid = f.fk_soc AND f.fk_statut = 0"; $sql.= " AND f.entity = ".$conf->entity; @@ -274,6 +275,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $companystatic->id=$obj->socid; $companystatic->name=$obj->name; $companystatic->email=$obj->email; + $companystatic->country_id=$obj->country_id; + $companystatic->country_code=$obj->country_code; $companystatic->fournisseur = 1; $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; @@ -324,8 +327,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $sql.= ", s.nom as name"; $sql.= ", s.rowid as socid"; $sql.= ", s.code_client, s.code_compta, s.email"; - $sql.= ", sum(pf.amount) as am"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + $sql.= ", cc.rowid as country_id, cc.code as country_code"; + $sql.= ", sum(pf.amount) as am"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays, ".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.rowid = f.fk_soc"; @@ -338,7 +342,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $sql.=$hookmanager->resPrint; $sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,"; - $sql.= " s.nom, s.rowid, s.code_client, s.code_compta, s.email"; + $sql.= " s.nom, s.rowid, s.code_client, s.code_compta, s.email,"; + $sql.= " cc.rowid, cc.code"; $sql.= " ORDER BY f.tms DESC "; $sql.= $db->plimit($max, 0); @@ -375,6 +380,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $thirdpartystatic->id=$obj->socid; $thirdpartystatic->name=$obj->name; $thirdpartystatic->email=$obj->email; + $thirdpartystatic->country_id=$obj->country_id; + $thirdpartystatic->country_code=$obj->country_code; + $thirdpartystatic->email=$obj->email; $thirdpartystatic->client=1; $thirdpartystatic->code_client = $obj->code_client; //$thirdpartystatic->code_fournisseur = $obj->code_fournisseur; @@ -696,8 +704,9 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $sql.= ", s.nom as name, s.email"; $sql.= ", s.rowid as socid"; $sql.= ", s.code_client, s.code_compta"; - $sql.= ", c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva as total_tva, c.total_ttc"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= ", c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva as total_tva, c.total_ttc,"; + $sql.= " cc.rowid as country_id, cc.code as country_code"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_source = c.rowid AND el.sourcetype = 'commande'"; @@ -741,6 +750,8 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $societestatic->id=$obj->socid; $societestatic->name=$obj->name; $societestatic->email=$obj->email; + $societestatic->country_id=$obj->country_id; + $societestatic->country_code=$obj->country_code; $societestatic->client=1; $societestatic->code_client = $obj->code_client; //$societestatic->code_fournisseur = $obj->code_fournisseur; @@ -813,8 +824,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $sql.= ", s.nom as name"; $sql.= ", s.rowid as socid, s.email"; $sql.= ", s.code_client, s.code_compta"; - $sql.= ", sum(pf.amount) as am"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + $sql.= ", cc.rowid as country_id, cc.code as country_code"; + $sql.= ", sum(pf.amount) as am"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays,".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.rowid = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1"; @@ -826,8 +838,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters); $sql.=$hookmanager->resPrint; - $sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,"; - $sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta"; + $sql.= " GROUP BY f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,"; + $sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code"; $sql.= " ORDER BY f.datef ASC, f.facnumber ASC"; $resql = $db->query($sql); @@ -865,6 +877,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $societestatic->id=$obj->socid; $societestatic->name=$obj->name; $societestatic->email=$obj->email; + $societestatic->country_id=$obj->country_id; + $societestatic->country_code=$obj->country_code; $societestatic->client=1; $societestatic->code_client = $obj->code_client; $societestatic->code_fournisseur = $obj->code_fournisseur; diff --git a/htdocs/dav/fileserver.php b/htdocs/dav/fileserver.php index 0f5f365336b..a1d145306f5 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -98,9 +98,20 @@ $authBackend->setRealm(constant('DOL_APPLICATION_TITLE')); $nodes = array(); // Enable directories and features according to DAV setup -// / Public docs -if (!empty($conf->global->DAV_ALLOW_PUBLIC_DIR)) $nodes[] = new \Sabre\DAV\FS\Directory($dolibarr_main_data_root. '/dav/public'); +// Public dir +if (!empty($conf->global->DAV_ALLOW_PUBLIC_DIR)) +{ + $nodes[] = new \Sabre\DAV\FS\Directory($dolibarr_main_data_root. '/dav/public'); +} +// Private dir $nodes[] = new \Sabre\DAV\FS\Directory($dolibarr_main_data_root. '/dav/private'); +// ECM dir +if (! empty($conf->ecm->enabled) && ! empty($conf->global->DAV_ALLOW_ECM_DIR)) +{ + $nodes[] = new \Sabre\DAV\FS\Directory($dolibarr_main_data_root. '/ecm'); +} + + // Principals Backend //$principalBackend = new \Sabre\DAVACL\PrincipalBackend\Dolibarr($user,$db); diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 81c8aadf7c8..c4fda400621 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -142,7 +142,7 @@ CalcModeVATDebt=Mode %sVAT on commitment accounting%s. CalcModeVATEngagement=Mode %sVAT on incomes-expenses%s. CalcModeDebt=Analysis of known recorded invoices even if they are not yet accounted in ledger. CalcModeEngagement=Analysis of known recorded payments, even if they are not yet accounted in Ledger. -CalcModeBookkeeping=Analysis of data journalized in Bookkeeping Ledger table +CalcModeBookkeeping=Analysis of data journalized in Bookkeeping Ledger table. CalcModeLT1= Mode %sRE on customer invoices - suppliers invoices%s CalcModeLT1Debt=Mode %sRE on customer invoices%s CalcModeLT1Rec= Mode %sRE on suppliers invoices%s diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 80445e76e25..fd2c509233b 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -53,7 +53,10 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); -$arrayofparameters=array('MYMODULE_MYPARAM1'=>array('css'=>'minwidth200'), 'MYMODULE_MYPARAM2'=>array('css'=>'minwidth500')); +$arrayofparameters=array( + 'MYMODULE_MYPARAM1'=>array('css'=>'minwidth200','enabled'=>1), + 'MYMODULE_MYPARAM2'=>array('css'=>'minwidth500','enabled'=>1) +); /* @@ -96,6 +99,8 @@ if ($action == 'edit') foreach($arrayofparameters as $key => $val) { + if (isset($val['enabled']) && empty($val['enabled'])) continue; + print ''; print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip')); print ''; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 0e43aedc4e7..21ab2d6cafe 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -262,13 +262,13 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); $nbtotalofrecords = $db->num_rows($resql); - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 { $page = 0; $offset = 0; } } -// if total resultset is smaller than limit, no need to do paging adn restart select with limits. +// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 93474b16554..70e09114669 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1443,7 +1443,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ // On l'ajoute donc pour remettre a niveau (pb vieilles versions) //$object->updatePrice($object->price, $object->price_base_type, $user, $newprice_min); if (! empty($conf->global->PRODUIT_MULTIPRICES)) { - $object->updatePrice($object->multiprices[1], $object->multiprices_base_type[1], $user, $object->multiprices_tva_tx[1], $object->multiprices_min[1], 1); + $object->updatePrice($object->multiprices[1], $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1])?0:$object->multiprices_tva_tx[1]), $object->multiprices_min[1], 1); } else { $object->updatePrice($object->price, $object->price_base_type, $user, $object->tva_tx, $object->price_min); }