';
- // Boutons d'actions
if ($cancreate && $object->statut == Holiday::STATUS_DRAFT)
{
print '
';
diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php
index 84e7b36c239..f74d731e8bd 100644
--- a/htdocs/holiday/list.php
+++ b/htdocs/holiday/list.php
@@ -61,6 +61,18 @@ if ($user->societe_id > 0) // Protection if external user
}
$result = restrictedArea($user, 'holiday', $id, '');
$id = GETPOST('id', 'int');
+// If we are on the view of a specific user
+if ($id > 0)
+{
+ $canread=0;
+ if ($id == $user->id) $canread=1;
+ if (! empty($user->rights->holiday->read_all)) $canread=1;
+ if (! empty($user->rights->holiday->read) && in_array($id, $childids)) $canread=1;
+ if (! $canread)
+ {
+ accessforbidden();
+ }
+}
// Load variable for pagination
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
@@ -319,11 +331,12 @@ if ($id > 0) // For user tab
dol_fiche_end();
+ // Buttons for actions
+
print '
';
$canedit=(($user->id == $user_id && $user->rights->holiday->write) || ($user->id != $user_id && $user->rights->holiday->write_all));
- // Boutons d'actions
if ($canedit)
{
print '
'.$langs->trans("AddCP").'';
diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php
index 6b3a6400bc3..21e9b56b4bb 100644
--- a/htdocs/includes/odtphp/odf.php
+++ b/htdocs/includes/odtphp/odf.php
@@ -745,7 +745,7 @@ IMG;
private function _rrmdir($dir)
{
if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
+ while (($file = readdir($handle)) !== false) {
if ($file != '.' && $file != '..') {
if (is_dir($dir . '/' . $file)) {
$this->_rrmdir($dir . '/' . $file);
diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
index 40f7da3fa95..1270b8b279a 100644
--- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
+++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
@@ -60,6 +60,8 @@ CREATE TABLE llx_pos_cash_fence(
-- For 10.0
+UPDATE llx_chargesociales SET date_creation = tms WHERE date_creation IS NULL;
+
DROP TABLE llx_cotisation;
ALTER TABLE llx_accounting_bookkeeping DROP COLUMN validated;
ALTER TABLE llx_accounting_bookkeeping_tmp DROP COLUMN validated;
diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql
index 387f8e159ec..076f1962325 100755
--- a/htdocs/install/mysql/migration/repair.sql
+++ b/htdocs/install/mysql/migration/repair.sql
@@ -199,6 +199,15 @@ delete from llx_element_element where sourcetype='commande' and fk_source not in
DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm);
+-- Fix link on parent that were removed
+DROP table tmp_user;
+CREATE TABLE tmp_user as (select * from llx_user);
+UPDATE llx_user SET fk_user = NULL where fk_user NOT IN (select rowid from tmp_user);
+
+
+update llx_user set fk_user = null where fk_user not in (select rowid from llx_user);
+
+
UPDATE llx_product SET canvas = NULL where canvas = 'default@product';
UPDATE llx_product SET canvas = NULL where canvas = 'service@product';
@@ -400,6 +409,7 @@ ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (accou
-- p.tva_tx = 0
-- where price = 17.5
+UPDATE llx_chargesociales SET date_creation = tms WHERE date_creation IS NULL;
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
-- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL;
diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql
index ed4919c3fc5..e7a948d67c2 100644
--- a/htdocs/install/mysql/tables/llx_societe.sql
+++ b/htdocs/install/mysql/tables/llx_societe.sql
@@ -65,34 +65,34 @@ create table llx_societe
fk_typent integer DEFAULT 0, --
fk_forme_juridique integer DEFAULT 0, -- juridical status
fk_currency varchar(3), -- default currency
- siren varchar(128), -- IDProf1: siren or RCS for france, ...
- siret varchar(128), -- IDProf2: siret for france, ...
- ape varchar(128), -- IDProf3: code ape for france, ...
- idprof4 varchar(128), -- IDProf4: nu for france
- idprof5 varchar(128), -- IDProf5: nu for france
- idprof6 varchar(128), -- IDProf6: nu for france
- tva_intra varchar(20), -- tva
- capital double(24,8) DEFAULT NULL, -- capital de la societe
- fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial statut
+ siren varchar(128), -- IDProf1: depends on country (example: siren or RCS for france, ...)
+ siret varchar(128), -- IDProf2: depends on country (example: siret for france, ...)
+ ape varchar(128), -- IDProf3: depends on country (example: code ape for france, ...)
+ idprof4 varchar(128), -- IDProf4: depends on country (example: nu for france, ...)
+ idprof5 varchar(128), -- IDProf5: depends on country (example: nu for france, ...)
+ idprof6 varchar(128), -- IDProf6: depends on country (example: nu for france, ...
+ tva_intra varchar(20), -- vat numero
+ capital double(24,8) DEFAULT NULL, -- capital of company
+ fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial status
note_private text, --
note_public text, --
model_pdf varchar(255),
- prefix_comm varchar(5), -- prefix commercial
+ prefix_comm varchar(5), -- prefix commercial (deprecated)
client tinyint DEFAULT 0, -- client 0/1/2
fournisseur tinyint DEFAULT 0, -- fournisseur 0/1
- supplier_account varchar(32), -- compte client chez un fournisseur
+ supplier_account varchar(32), -- Id of our customer account known by the supplier
fk_prospectlevel varchar(12), -- prospect level (in llx_c_prospectlevel)
fk_incoterms integer, -- for incoterms
location_incoterms varchar(255), -- for incoterms
customer_bad tinyint DEFAULT 0, -- mauvais payeur 0/1
customer_rate real DEFAULT 0, -- taux fiabilite client (0 a 1)
supplier_rate real DEFAULT 0, -- taux fiabilite fournisseur (0 a 1)
- remise_client real DEFAULT 0, -- remise systematique pour le client
- remise_supplier real DEFAULT 0, -- remise systematique auprès du fournisseur
- mode_reglement tinyint, -- mode de reglement
- cond_reglement tinyint, -- condition de reglement
- mode_reglement_supplier tinyint, -- mode de reglement fournisseur
- cond_reglement_supplier tinyint, -- condition de reglement fournisseur
+ remise_client real DEFAULT 0, -- discount by default granted to this customer
+ remise_supplier real DEFAULT 0, -- discount by default granted by this supplier
+ mode_reglement tinyint, -- payment mode customer
+ cond_reglement tinyint, -- payment term customer
+ mode_reglement_supplier tinyint, -- payment mode supplier
+ cond_reglement_supplier tinyint, -- payment term supplier
fk_shipping_method integer, -- preferred shipping method id
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index da6f3c5a466..cc2eb5062cb 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -421,6 +421,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Buttons for actions
+
if ($action != 'presend' && $action != 'editline') {
print '
'."\n";
$parameters=array();
diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php
index 076461043b8..1b3034bb82c 100644
--- a/htdocs/opensurvey/results.php
+++ b/htdocs/opensurvey/results.php
@@ -249,8 +249,8 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D")
$dateinsertion = substr("$dateinsertion", 1);
- //mise a jour avec les nouveaux sujets dans la base
- if (isset($erreur_ajout_date) && !$erreur_ajout_date)
+ // update with new topics into database
+ if (isset($erreur_ajout_date) && empty($erreur_ajout_date))
{
$sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage";
$sql.= " SET sujet = '".$db->escape($dateinsertion)."'";
@@ -619,7 +619,7 @@ print '
'."\n";
print ' | '."\n";
print ' | '."\n";
-//boucle pour l'affichage des boutons de suppression de colonne
+// loop to show the delete link
if ($user->rights->opensurvey->write) {
for ($i = 0; isset($toutsujet[$i]); $i++) {
diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php
index 8840da3f3e7..76f390c470b 100644
--- a/htdocs/opensurvey/wizard/choix_date.php
+++ b/htdocs/opensurvey/wizard/choix_date.php
@@ -471,7 +471,7 @@ for ($i = 0; $i < $nbrejourmois + $premierjourmois; $i++) {
{
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($j = 0; $j < $nbofchoice; $j++) {
- //affichage des boutons ROUGES
+ // show red buttons
if (date("j", $_SESSION["totalchoixjour"][$j]) == $numerojour && date("n", $_SESSION["totalchoixjour"][$j]) == $_SESSION["mois"] && date("Y", $_SESSION["totalchoixjour"][$j]) == $_SESSION["annee"]) {
print ' | '."\n";
$dejafait = $numerojour;
@@ -479,13 +479,13 @@ for ($i = 0; $i < $nbrejourmois + $premierjourmois; $i++) {
}
}
- //Si pas de bouton ROUGE alors on affiche un bouton VERT ou GRIS avec le numéro du jour dessus
+ // If no red button, we show green or grey button with number of day
if (isset($dejafait) === false || $dejafait != $numerojour){
- //bouton vert
+ // green button
if (($numerojour >= $jourAJ && $_SESSION["mois"] == $moisAJ && $_SESSION["annee"] == $anneeAJ) || ($_SESSION["mois"] > $moisAJ && $_SESSION["annee"] == $anneeAJ) || $_SESSION["annee"] > $anneeAJ) {
print ' | '."\n";
} else {
- //bouton gris
+ // grey button
print ''.$numerojour.' | '."\n";
}
}
@@ -547,7 +547,7 @@ if (issetAndNoEmpty('totalchoixjour', $_SESSION) || $erreur)
print ''."\n";
- //affichage des boutons de formulaire pour annuler, effacer les jours ou créer le sondage
+ // show buttons to cancel, delete days or create survey
print ''."\n";
print ''."\n";
print ' | | |
'."\n";
diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php
index 0c746fcf8b2..c2e6db1a709 100644
--- a/htdocs/opensurvey/wizard/create_survey.php
+++ b/htdocs/opensurvey/wizard/create_survey.php
@@ -194,7 +194,7 @@ if (GETPOST('choix_sondage'))
}
else
{
- // affichage des boutons pour choisir sondage date ou autre
+ // Show image to selecte between date survey or other survey
print '
'."\n";
print '| '. $langs->trans("CreateSurveyDate") .' | | '."\n";
print ' |
'."\n";
diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php
index e76c6884b7f..cfbedbcb7f1 100644
--- a/htdocs/product/admin/product_tools.php
+++ b/htdocs/product/admin/product_tools.php
@@ -333,7 +333,8 @@ else
print '
';
- // Boutons actions
+ // Buttons for actions
+
print '';
print '';
print '
';
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 5b5b9ad48fa..26970f1dd13 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -153,7 +153,7 @@ if (empty($reshook))
$db->begin();
$resql = $object->update($object->id, $user);
- if (! $resql || $resql < 0)
+ if ($resql <= 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index c762b7f65e7..6b1d5e0a07f 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -5,6 +5,7 @@
* Copyright (C) 2013 Florian Henry
* Copyright (C) 2014-2017 Marcos García
* Copyright (C) 2017 Ferran Marcet
+ * Copyright (C) 2019 Juanjo Menent
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -707,6 +708,27 @@ class Project extends CommonObject
$ret = $this->deleteTasks($user);
if ($ret < 0) $error++;
+
+ // Delete all child tables
+ if (! $error) {
+ $elements = array('categorie_project'); // elements to delete. TODO Make goodway to delete
+ foreach($elements as $table)
+ {
+ if (! $error) {
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX.$table;
+ $sql.= " WHERE fk_project = ".$this->id;
+
+ $result = $this->db->query($sql);
+ if (! $result) {
+ $error++;
+ $this->errors[] = $this->db->lasterror();
+ }
+ }
+ }
+ }
+
+
+
// Delete project
if (! $error)
{
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index d55ea537297..d7034017691 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -952,10 +952,10 @@ else
$object->name = GETPOST('name', 'alpha');
$object->firstname = GETPOST('firstname', 'alpha');
$object->particulier = $private;
- $object->prefix_comm = GETPOST('prefix_comm');
- $object->client = GETPOST('client')?GETPOST('client'):$object->client;
+ $object->prefix_comm = GETPOST('prefix_comm', 'alpha');
+ $object->client = GETPOST('client', 'int')?GETPOST('client', 'int'):$object->client;
- if(empty($duplicate_code_error)) {
+ if (empty($duplicate_code_error)) {
$object->code_client = GETPOST('customer_code', 'alpha');
$object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur;
}
@@ -1187,7 +1187,7 @@ else
// Prospect/Customer
print '| '.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).' | ';
print '';
- $selected=GETPOST('client', 'int')!=''?GETPOST('client', 'int'):$object->client;
+ $selected=(GETPOSTISSET('client', 'int')?GETPOST('client', 'int'):$object->client);
print $formcompany->selectProspectCustomerType($selected);
print ' | ';
diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php
index 3fc7b225c77..a82ad69091b 100644
--- a/htdocs/societe/class/societeaccount.class.php
+++ b/htdocs/societe/class/societeaccount.class.php
@@ -320,7 +320,7 @@ class SocieteAccount extends CommonObject
* @param string $id Id of customer in external system (example: 'cu_xxxxxxxxxxxxx', ...)
* @param string $site Site (example: 'stripe', '...')
* @param int $status Status (0=test, 1=live)
- * @return string Id of third party
+ * @return int Id of third party
* @see getCustomerAccount()
*/
public function getThirdPartyID($id, $site, $status = 0)
diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php
index dd66c7607e5..d754b8d3962 100644
--- a/htdocs/stripe/class/stripe.class.php
+++ b/htdocs/stripe/class/stripe.class.php
@@ -247,6 +247,8 @@ class Stripe extends CommonObject
*/
public function getPaymentMethodStripe($paymentmethod, $key = '', $status = 0)
{
+ $stripepaymentmethod = null;
+
try {
// Force to use the correct API key
global $stripearrayofkeysbyenv;
@@ -261,6 +263,7 @@ class Stripe extends CommonObject
{
$this->error = $e->getMessage();
}
+
return $stripepaymentmethod;
}
diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php
index c0cd029126d..1d00718401b 100644
--- a/htdocs/theme/eldy/btn.inc.php
+++ b/htdocs/theme/eldy/btn.inc.php
@@ -5,7 +5,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
/* ============================================================================== */
-/* Boutons actions */
+/* Buttons for actions */
/* ============================================================================== */
div.divButAction {
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index e5e68e59c48..9061595dd1d 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -2362,7 +2362,7 @@ span.tabspan {
}
/* ============================================================================== */
-/* Boutons actions */
+/* Buttons for actions */
/* ============================================================================== */
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 752f60541d1..8020a490181 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -2400,7 +2400,7 @@ div.tabBar table.tableforservicepart2:last-child {
}
/* ============================================================================== */
-/* Boutons actions */
+/* Buttons for actions */
/* ============================================================================== */
div.divButAction {
@@ -2503,7 +2503,7 @@ span.tabspan {
}
/* ============================================================================== */
-/* Boutons actions */
+/* Buttons for actions */
/* ============================================================================== */
div.divButAction {
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 34651304b95..a151fdb5574 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -774,7 +774,7 @@ class User extends CommonObject
dol_syslog(get_class($this)."::clearrights reset user->rights");
$this->rights='';
$this->nb_rights=0;
- $this->all_permissions_are_loaded=false;
+ $this->all_permissions_are_loaded=0;
$this->_tab_loaded=array();
}
@@ -799,16 +799,16 @@ class User extends CommonObject
return;
}
- if ($this->all_permissions_are_loaded)
+ if (! empty($this->all_permissions_are_loaded))
{
// We already loaded all rights for this user, so we leave
return;
}
}
- // Recuperation des droits utilisateurs + recuperation des droits groupes
+ // Get permission of users + Get permissions of groups
- // D'abord les droits utilisateurs
+ // First user permissions
$sql = "SELECT DISTINCT r.module, r.perms, r.subperms";
$sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= ", ".MAIN_DB_PREFIX."rights_def as r";
@@ -862,7 +862,7 @@ class User extends CommonObject
$this->db->free($resql);
}
- // Maintenant les droits groupes
+ // Now permissions of groups
$sql = "SELECT DISTINCT r.module, r.perms, r.subperms";
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,";
$sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu,";
@@ -933,7 +933,7 @@ class User extends CommonObject
}
else
{
- // Si module defini, on le marque comme charge en cache
+ // If module defined, we flag it as loaded into cache
$this->_tab_loaded[$moduletag]=1;
}
}
@@ -2300,7 +2300,6 @@ class User extends CommonObject
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
$result=''; $label='';
- $link=''; $linkstart=''; $linkend='';
if (! empty($this->photo))
{
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index c3fe000292c..d51d82c8d13 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -552,13 +552,13 @@ class UserGroup extends CommonObject
if ($moduletag && isset($this->_tab_loaded[$moduletag]) && $this->_tab_loaded[$moduletag])
{
- // Le fichier de ce module est deja charge
+ // Rights for this module are already loaded, so we leave
return;
}
if (! empty($this->all_permissions_are_loaded))
{
- // Si les permissions ont deja ete chargees, on quitte
+ // We already loaded all rights for this group, so we leave
return;
}
@@ -618,7 +618,7 @@ class UserGroup extends CommonObject
}
else
{
- // Si module defini, on le marque comme charge en cache
+ // If module defined, we flag it as loaded into cache
$this->_tab_loaded[$moduletag]=1;
}
@@ -867,7 +867,6 @@ class UserGroup extends CommonObject
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpicto) $withpicto=0;
$result=''; $label='';
- $link=''; $linkstart=''; $linkend='';
$label.= '';
$label.= '' . $langs->trans("Group") . '
';
@@ -957,7 +956,7 @@ class UserGroup extends CommonObject
public function _load_ldap_info()
{
// phpcs:enable
- global $conf,$langs;
+ global $conf;
$info=array();
diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php
index 2ded2013601..90228aa952e 100644
--- a/htdocs/user/param_ihm.php
+++ b/htdocs/user/param_ihm.php
@@ -173,7 +173,7 @@ if (! empty($conf->projet->enabled)) $tmparray['projet/index.php?mainmenu=projec
if (! empty($conf->holiday->enabled) || ! empty($conf->expensereport->enabled)) $tmparray['hrm/index.php?mainmenu=hrm&leftmenu=']='HRMArea'; // TODO Complete list with first level of menus
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) $tmparray['product/index.php?mainmenu=products&leftmenu=']='ProductsAndServicesArea';
if (! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->contrat->enabled)) $tmparray['comm/index.php?mainmenu=commercial&leftmenu=']='CommercialArea';
-if (! empty($conf->compta->enabled) || ! empty($conf->accounting->enabled)) $tmparray['compta/index.php?mainmenu=compta&leftmenu=']='AccountancyTreasuryArea';
+if (! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled)) $tmparray['compta/index.php?mainmenu=compta&leftmenu=']='AccountancyTreasuryArea';
if (! empty($conf->adherent->enabled)) $tmparray['adherents/index.php?mainmenu=members&leftmenu=']='MembersArea';
if (! empty($conf->agenda->enabled)) $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu=']='Agenda';
diff --git a/htdocs/website/class/index.html b/htdocs/website/class/index.html
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/htdocs/website/lib/index.html b/htdocs/website/lib/index.html
new file mode 100644
index 00000000000..e69de29bb2d