From 60525b9c181d0d2de728a34ec1cd57e7b39ac1be Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 25 Feb 2018 15:35:41 +0100 Subject: [PATCH 01/21] Fix: multicompany transverse mode is managed by the module --- htdocs/user/card.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index e6ced69ea64..8cc18900d70 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -67,9 +67,7 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $canreadgroup=(! empty($user->admin) || $user->rights->user->group_advance->read); $caneditgroup=(! empty($user->admin) || $user->rights->user->group_advance->write); } -if(! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { - $caneditgroup = ($conf->entity == 1) && ! empty($user->admin) && empty($user->entity); -} + // Define value to know what current user can do on properties of edited user if ($id) { From d8a0cb73872f311b58b818c8f5294e9a5cff18da Mon Sep 17 00:00:00 2001 From: guillaume-uH57J9 Date: Sun, 25 Feb 2018 19:43:53 +0100 Subject: [PATCH 02/21] install, don't use innodb engine for pgsql --- htdocs/install/step2.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 44661c191d7..a891a2f590e 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -201,8 +201,10 @@ if ($action == "set") { $buffer=preg_replace('/type=innodb/i','ENGINE=innodb',$buffer); } - else if ($conf->db->type == 'mssql') + else { + // Keyword ENGINE is MySQL-specific, so scrub it for + // other database types (mssql, pgsql) $buffer=preg_replace('/type=innodb/i','',$buffer); $buffer=preg_replace('/ENGINE=innodb/i','',$buffer); } From ef60d095c0b2b8a0495b48a94e41fae9b8764d0c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 25 Feb 2018 19:55:10 +0100 Subject: [PATCH 03/21] Fix: syntax error --- htdocs/install/mysql/tables/llx_expensereport_rules.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_expensereport_rules.sql b/htdocs/install/mysql/tables/llx_expensereport_rules.sql index e6103ee8fb9..3aaca6f00b5 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_rules.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_rules.sql @@ -31,4 +31,4 @@ CREATE TABLE llx_expensereport_rules ( code_expense_rules_type varchar(50) NOT NULL, is_for_all tinyint DEFAULT '0', entity integer DEFAULT 1 -) ENGINE=InnoDB \ No newline at end of file +) ENGINE=InnoDB; \ No newline at end of file From 093ea49cc67161ec6075be1859932ee1a86c2d97 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 25 Feb 2018 17:43:19 +0100 Subject: [PATCH 04/21] Fix: use "multidir_output" instead "dir_output" --- htdocs/admin/propal.php | 2 +- htdocs/api/class/api_documents.class.php | 2 +- htdocs/comm/index.php | 6 +++--- htdocs/comm/propal/card.php | 6 +++--- htdocs/comm/propal/class/propal.class.php | 10 +++++----- htdocs/comm/propal/document.php | 4 ++-- htdocs/comm/propal/index.php | 9 +++++---- htdocs/comm/propal/list.php | 8 ++++---- htdocs/core/class/conf.class.php | 5 ++++- htdocs/core/class/html.formfile.class.php | 3 +++ htdocs/core/class/notify.class.php | 8 ++++---- htdocs/core/lib/files.lib.php | 19 +++++++++---------- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/lib/propal.lib.php | 4 ++-- .../doc/doc_generic_proposal_odt.modules.php | 8 ++++---- .../modules/propale/doc/pdf_azur.modules.php | 8 ++++---- 16 files changed, 55 insertions(+), 49 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 8d09e81e142..ee0db9d594a 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -631,7 +631,7 @@ print "\n"; print " ".$langs->trans("Name")."\n"; print " ".$langs->trans("Value")."\n"; print "\n"; -print "\n ".$langs->trans("PathDirectory")."\n ".$conf->propal->dir_output."\n\n"; +print "\n ".$langs->trans("PathDirectory")."\n ".$conf->propal->multidir_output[$conf->entity]."\n\n"; print "\n
"; diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index d5b30d67d11..07f124741fe 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -306,7 +306,7 @@ class Documents extends DolibarrApi throw new RestException(404, 'Proposal not found'); } - $upload_dir = $conf->propal->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'propal'); + $upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal'); } else if ($modulepart == 'commande' || $modulepart == 'order') { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 91004c86f67..bdf92b31905 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -676,8 +676,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { $langs->load("propal"); - $sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; - $sql.= ", s.code_client"; + $sql = "SELECT s.nom as name, s.rowid, s.code_client"; + $sql.= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -726,7 +726,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) print ''; print ''; $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid; print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 02c1b0e65bb..37df118773f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1292,7 +1292,7 @@ if (empty($reshook)) } // Actions to build doc - $upload_dir = $conf->propal->dir_output; + $upload_dir = $conf->propal->multidir_output[$object->entity]; $permissioncreate=$user->rights->propal->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; @@ -2425,7 +2425,7 @@ if ($action == 'create') * Documents generes */ $filename = dol_sanitizeFileName($object->ref); - $filedir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); + $filedir = $conf->propal->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref); $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $genallowed = $user->rights->propal->lire; $delallowed = $user->rights->propal->creer; @@ -2466,7 +2466,7 @@ if ($action == 'create') // Presend form $modelmail='propal_send'; $defaulttopic='SendPropalRef'; - $diroutput = $conf->propal->dir_output; + $diroutput = $conf->propal->multidir_output[$object->entity]; $trackid = 'pro'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 850fa969bbb..3adc58ecbae 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1749,8 +1749,8 @@ class Propal extends CommonObject // to not lose the linked files $oldref = dol_sanitizeFileName($this->ref); $newref = dol_sanitizeFileName($num); - $dirsource = $conf->propal->dir_output.'/'.$oldref; - $dirdest = $conf->propal->dir_output.'/'.$newref; + $dirsource = $conf->propal->multidir_output[$this->entity].'/'.$oldref; + $dirdest = $conf->propal->multidir_output[$this->entity].'/'.$newref; if (file_exists($dirsource)) { @@ -1759,7 +1759,7 @@ class Propal extends CommonObject { dol_syslog("Rename ok"); // Rename docs starting with $oldref with $newref - $listoffiles=dol_dir_list($conf->propal->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/')); + $listoffiles=dol_dir_list($dirdest, 'files', 1, '^'.preg_quote($oldref,'/')); foreach($listoffiles as $fileentry) { $dirsource=$fileentry['name']; @@ -2815,9 +2815,9 @@ class Propal extends CommonObject { // We remove directory $ref = dol_sanitizeFileName($this->ref); - if ($conf->propal->dir_output && !empty($this->ref)) + if ($conf->propal->multidir_output[$this->entity] && !empty($this->ref)) { - $dir = $conf->propal->dir_output . "/" . $ref ; + $dir = $conf->propal->multidir_output[$this->entity] . "/" . $ref ; $file = $dir . "/" . $ref . ".pdf"; if (file_exists($file)) { diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index ba373c78f44..4ceae6b1221 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -75,7 +75,7 @@ $object->fetch($id,$ref); if ($object->id > 0) { $object->fetch_thirdparty(); - $upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->propal->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; } @@ -90,7 +90,7 @@ $form = new Form($db); if ($object->id > 0) { - $upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->propal->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); $head = propal_prepare_head($object); dol_fiche_head($head, 'document', $langs->trans('Proposal'), -1, 'propal'); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index a313ab299f0..e9dce10ea0b 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -216,7 +216,7 @@ $max=5; * Last modified proposals */ -$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as socname, s.rowid as socid, s.canvas, s.client,"; +$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, s.nom as socname, s.rowid as socid, s.canvas, s.client,"; $sql.= " date_cloture as datec"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; @@ -262,7 +262,7 @@ if ($resql) print ''; $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print ''; @@ -296,7 +296,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) $now=dol_now(); - $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; + $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client"; + $sql.= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -341,7 +342,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) print ''; print ''; $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid; print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index a47625e100b..3bc3b120a84 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -110,7 +110,7 @@ if (! empty($socid)) } $result = restrictedArea($user, $module, $objectid, $dbtable); -$diroutputmassaction=$conf->propal->dir_output . '/temp/massgeneration/'.$user->id; +$diroutputmassaction=$conf->propal->multidir_output[$conf->entity] . '/temp/massgeneration/'.$user->id; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('propallist')); @@ -214,7 +214,7 @@ if (empty($reshook)) $objectlabel='Proposals'; $permtoread = $user->rights->propal->lire; $permtodelete = $user->rights->propal->supprimer; - $uploaddir = $conf->propal->dir_output; + $uploaddir = $conf->propal->multidir_output[$conf->entity]; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -242,7 +242,7 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; -$sql.= ' p.rowid, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,'; +$sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,'; $sql.= ' p.datec as date_creation, p.tms as date_update,'; $sql.= " pr.rowid as project_id, pr.ref as project_ref,"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,"; @@ -663,7 +663,7 @@ if ($resql) // Other picto tool print ''; $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print ''; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index a1d051440c3..0705d2fd60d 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -310,7 +310,7 @@ class Conf // For user storage $this->user->multidir_output = array($this->entity => $rootfordata."/users"); - $this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp"); + $this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp"); // For backward compatibility $this->user->dir_output=$rootforuser."/users"; $this->user->dir_temp=$rootforuser."/users/temp"; @@ -320,6 +320,9 @@ class Conf $this->usergroup->dir_temp=$rootforuser."/usergroups/temp"; // For propal storage + $this->propal->multidir_output = array($this->entity => $rootfordata."/propale"); + $this->propal->multidir_temp = array($this->entity => $rootfordata."/propale/temp"); + // For backward compatibility $this->propal->dir_output=$rootfordata."/propale"; $this->propal->dir_temp=$rootfordata."/propale/temp"; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index b139483b610..ffe5a459699 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -299,6 +299,9 @@ class FormFile return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } + // Add entity in $param + $param.= 'entity='.(!empty($object->entity)?$object->entity:$conf->entity); + $printer=0; if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur', 'expensereport'))) // The direct print feature is implemented only for such elements { diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 7554a82a5fd..cff29099743 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -392,13 +392,13 @@ class Notify break; case 'PROPAL_VALIDATE': $link='/comm/propal/card.php?id='.$object->id; - $dir_output = $conf->propal->dir_output; + $dir_output = $conf->propal->multidir_output[$object->entity]; $object_type = 'propal'; $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref); break; case 'PROPAL_CLOSE_SIGNED': $link='/comm/propal/card.php?id='.$object->id; - $dir_output = $conf->propal->dir_output; + $dir_output = $conf->propal->multidir_output[$object->entity]; $object_type = 'propal'; $mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref); break; @@ -574,13 +574,13 @@ class Notify break; case 'PROPAL_VALIDATE': $link='/comm/propal/card.php?id='.$object->id; - $dir_output = $conf->propal->dir_output; + $dir_output = $conf->propal->multidir_output[$object->entity]; $object_type = 'propal'; $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref); break; case 'PROPAL_CLOSE_SIGNED': $link='/comm/propal/card.php?id='.$object->id; - $dir_output = $conf->propal->dir_output; + $dir_output = $conf->propal->multidir_output[$object->entity]; $object_type = 'propal'; $mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref); break; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 529f58dbbf1..fb816ece6c9 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2147,10 +2147,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file=$conf->facture->dir_output.'/'.$original_file; } // Wrapping pour les apercu propal - elseif ($modulepart == 'apercupropal' && !empty($conf->propal->dir_output)) + elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity])) { if ($fuser->rights->propale->{$lire}) $accessallowed=1; - $original_file=$conf->propal->dir_output.'/'.$original_file; + $original_file=$conf->propal->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les apercu commande elseif ($modulepart == 'apercucommande' && !empty($conf->commande->dir_output)) @@ -2195,10 +2195,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file=$conf->expensereport->dir_output.'/'.$original_file; } // Wrapping pour les images des stats propales - elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp)) + elseif ($modulepart == 'propalstats' && !empty($conf->propal->multidir_temp[$entity])) { if ($fuser->rights->propale->{$lire}) $accessallowed=1; - $original_file=$conf->propal->dir_temp.'/'.$original_file; + $original_file=$conf->propal->multidir_temp[$entity].'/'.$original_file; } // Wrapping pour les images des stats commandes elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp)) @@ -2362,13 +2362,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } // Wrapping for mass actions - else if ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->dir_output)) + else if ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->multidir_output[$entity])) { if ($fuser->rights->propal->{$lire} || preg_match('/^specimen/i',$original_file)) { $accessallowed=1; } - $original_file=$conf->propal->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file=$conf->propal->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file; } else if ($modulepart == 'massfilesarea_orders') { @@ -2402,7 +2402,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file=$conf->ficheinter->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } - else if ($modulepart == 'massfilesarea_supplier_proposal' && !empty($conf->propal->dir_output)) + else if ($modulepart == 'massfilesarea_supplier_proposal' && !empty($conf->supplier_proposal->dir_output)) { if ($fuser->rights->supplier_proposal->{$lire} || preg_match('/^specimen/i',$original_file)) { @@ -2457,14 +2457,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } // Wrapping pour les propales - else if ($modulepart == 'propal' && !empty($conf->propal->dir_output)) + else if ($modulepart == 'propal' && !empty($conf->propal->multidir_output[$entity])) { if ($fuser->rights->propale->{$lire} || preg_match('/^specimen/i',$original_file)) { $accessallowed=1; } - - $original_file=$conf->propal->dir_output.'/'.$original_file; + $original_file=$conf->propal->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."propal WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3f194d3531a..78cf44d2795 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7108,7 +7108,7 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0, $param='' if ($alldata == 1) { - if ($num_mime !== false) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath), 'mime'=>dol_mimetype($relativepath), ); + if ($num_mime !== false) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param?'&'.$param:''), 'mime'=>dol_mimetype($relativepath), ); else return array(); } diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index f0d42888745..c50661de831 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -35,7 +35,7 @@ function propal_prepare_head($object) $langs->load("propal"); $langs->load("compta"); $langs->load("companies"); - + $h = 0; $head = array(); @@ -86,7 +86,7 @@ function propal_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); + $upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index bc34d5b5691..0b71e9e862f 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -246,7 +246,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $outputlangs->load("companies"); $outputlangs->load("bills"); - if ($conf->propal->dir_output) + if ($conf->propal->multidir_output[$conf->entity]) { // If $object is id instead of object if (! is_object($object)) @@ -261,7 +261,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales } } - $dir = $conf->propal->dir_output; + $dir = $conf->propal->multidir_output[$object->entity]; $objectref = dol_sanitizeFileName($object->ref); if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; $file = $dir . "/" . $objectref . ".odt"; @@ -303,7 +303,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales //print "file=".$file; //print "conf->propal->dir_temp=".$conf->propal->dir_temp; - dol_mkdir($conf->propal->dir_temp); + dol_mkdir($conf->propal->multidir_temp[$object->entity]); // If CUSTOMER contact defined on proposal, we use it @@ -357,7 +357,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $odfHandler = new odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->propal->dir_temp, + 'PATH_TO_TMP' => $conf->propal->multidir_temp[$object->entity], 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 7be8b6a0d08..a54cfbf212f 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -230,7 +230,7 @@ class pdf_azur extends ModelePDFPropales if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; - if ($conf->propal->dir_output) + if ($conf->propal->multidir_output[$conf->entity]) { $object->fetch_thirdparty(); @@ -239,13 +239,13 @@ class pdf_azur extends ModelePDFPropales // Definition of $dir and $file if ($object->specimen) { - $dir = $conf->propal->dir_output; + $dir = $conf->propal->multidir_output[$conf->entity]; $file = $dir . "/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->propal->dir_output . "/" . $objectref; + $dir = $conf->propal->multidir_output[$object->entity] . "/" . $objectref; $file = $dir . "/" . $objectref . ".pdf"; } @@ -1501,7 +1501,7 @@ class pdf_azur extends ModelePDFPropales { $top_shift = $pdf->getY() - $current_y; } - + if ($showaddress) { // Sender properties From 365fffddf5e4bb0b2178781eea7c07e6ce027ef3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 26 Feb 2018 11:00:49 +0100 Subject: [PATCH 05/21] Fix: missing object entity --- htdocs/core/class/html.formfile.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index ffe5a459699..b7b94e7e644 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -850,6 +850,10 @@ class FormFile $out=''; $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); + // Get object entity + preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir).'$/', $filedir, $regs); + $entity = ((! empty($regs[1]) && $regs[1] > 1) ? $regs[1] : $conf->entity); + $filterforfilesearch = preg_quote(basename($modulesubdir),'/').'[^\-]+'; $file_list=dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) @@ -903,7 +907,7 @@ class FormFile } // Download - $tmpout.= '
  • Date: Mon, 26 Feb 2018 12:15:30 +0100 Subject: [PATCH 06/21] Fix: avoid warning during "upgrade2" process --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fd221649141..90747f0675b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4495,7 +4495,7 @@ abstract class CommonObject { $extrafields->fetch_name_optionals_label($this->table_element); } - $optionsArray = $extrafields->attributes[$this->table_element]['label']; + $optionsArray = (! empty($extrafields->attributes[$this->table_element]['label'])?$extrafields->attributes[$this->table_element]['label']:''); } else { From a4ae70020264861d293afd2ed254a1f0598a62fc Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Tue, 27 Feb 2018 11:11:32 +0100 Subject: [PATCH 07/21] FIX : Avoid empty value to fk_multicurrency attribute --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 92e04e1672b..5cf5b6c7b40 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4067,7 +4067,7 @@ class OrderLine extends CommonOrderLine $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").','; $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").','; $sql.= ' '.(!$this->fk_unit ? 'NULL' : $this->fk_unit); - $sql.= ", ".$this->fk_multicurrency; + $sql.= ", ".(! empty($this->fk_multicurrency) ? $this->fk_multicurrency : 'NULL'); $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql.= ", ".$this->multicurrency_subprice; $sql.= ", ".$this->multicurrency_total_ht; From 5b925a5912cefc2644cc2aaf51c9e005e7a02b91 Mon Sep 17 00:00:00 2001 From: Rui Strecht Date: Tue, 27 Feb 2018 11:08:23 +0000 Subject: [PATCH 08/21] Fix misspelled restore_lastsearch_values --- htdocs/product/stock/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 61bd5c3d47f..f732c44fc31 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -117,7 +117,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->su if ($result > 0) { setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); - header("Location: ".DOL_URL_ROOT.'/product/stock/list.php?resotre_lastsearch_values=1'); + header("Location: ".DOL_URL_ROOT.'/product/stock/list.php?restore_lastsearch_values=1'); exit; } else From e58cf4db42d98526310336059b96c9a223fa27ab Mon Sep 17 00:00:00 2001 From: Rui Strecht Date: Tue, 27 Feb 2018 11:44:03 +0000 Subject: [PATCH 09/21] Fix missing insert bill_time in project.class on create --- htdocs/projet/class/project.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ed25f3ba813..bc78d285945 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -196,6 +196,7 @@ class Project extends CommonObject $sql.= ", " . ($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); $sql.= ", " . (strcmp($this->opp_amount,'') ? price2num($this->opp_amount) : 'null'); $sql.= ", " . (strcmp($this->budget_amount,'') ? price2num($this->budget_amount) : 'null'); + $sql.= ", " . ($this->bill_time ? 1 : 0); $sql.= ", ".$conf->entity; $sql.= ")"; From 24ae7b4780213ae7a7f9598a1fc9b51de44ce9a8 Mon Sep 17 00:00:00 2001 From: Rui Strecht Date: Tue, 27 Feb 2018 14:45:17 +0000 Subject: [PATCH 10/21] Suppress count warning in admin_extrafields_view.tpl --- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/tpl/admin_extrafields_view.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index db0e7f4284a..a80e320c1e5 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -737,7 +737,7 @@ class ExtraFields dol_syslog("fetch_name_optionals_label elementtype=".$elementtype); $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed"; - $sql .= ",entity"; + $sql.= ",entity"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; $sql.= " WHERE entity IN (0,".$conf->entity.")"; if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 6ab7fecbf10..23e5aff0cae 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -67,7 +67,7 @@ if ($conf->multicompany->enabled) { print ' '; print "\n"; -if (count($extrafields->attributes[$elementtype]['type'])) +if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafields->attributes[$elementtype]['type'])) { foreach($extrafields->attributes[$elementtype]['type'] as $key => $value) { From 75735835647559fe1e29792030af0731f5275a3c Mon Sep 17 00:00:00 2001 From: dolibarr95 <24292300+dolibarr95@users.noreply.github.com> Date: Wed, 28 Feb 2018 11:24:00 +0100 Subject: [PATCH 11/21] Wrong var name --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 27b70e1b8cf..5ff1b133d20 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1272,7 +1272,7 @@ if ($action == 'create') print ''; if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - if (GETPOST('qtyl'.$indiceAsked, 'int')) $defaultqty=GETPOST('qtyl'.$indiceAsked, 'int'); + if (GETPOST('qtyl'.$indiceAsked, 'int')) $deliverableQty=GETPOST('qtyl'.$indiceAsked, 'int'); print ''; print ''; } From 5ef00d200fe83f98e57b7fd9fb990c7af75878fc Mon Sep 17 00:00:00 2001 From: Rui Strecht Date: Wed, 28 Feb 2018 12:26:05 +0000 Subject: [PATCH 12/21] Added idprof1 check to country PT --- htdocs/societe/class/societe.class.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f5c0f004794..9cf14b4bc9d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2876,6 +2876,29 @@ class Societe extends CommonObject return -4; } + //Verify NIF if country is PT + //Returns: 1 if NIF ok, -1 if NIF bad, 0 if unexpected bad + if ($idprof == 1 && $soc->country_code == 'PT') + { + $string=trim($this->idprof1); + $string=preg_replace('/(\s)/','',$string); + + for ($i = 0; $i < 9; $i ++) { + $num[$i] = substr($string, $i, 1); + } + + //Check NIF + if (preg_match('/(^[0-9]{9}$)/', $string)) { + return 1; + } + else { + return -1; + } + + //Wrong format + return 0; + } + return $ok; } From 9eb922826880c03a3632ab49059c7ebb60bdd7f4 Mon Sep 17 00:00:00 2001 From: Rui Strecht Date: Wed, 28 Feb 2018 12:51:29 +0000 Subject: [PATCH 13/21] Added idprof url for country PT --- htdocs/societe/class/societe.class.php | 35 ++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9cf14b4bc9d..9aa872fb064 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2920,20 +2920,35 @@ class Societe extends CommonObject $hookmanager->initHooks(array('idprofurl')); $parameters=array('idprof'=>$idprof, 'company'=>$thirdparty); $reshook=$hookmanager->executeHooks('getIdProfUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) - { - if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return ''; + if (empty($reshook)) { + if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) { + return ''; + } // TODO Move links to validate professional ID into a dictionary table "country" + "link" - if ($idprof == 1 && $thirdparty->country_code == 'FR') $url='http://www.societe.com/cgi-bin/search?champs='.$thirdparty->idprof1; // See also http://avis-situation-sirene.insee.fr/ - //if ($idprof == 1 && ($thirdparty->country_code == 'GB' || $thirdparty->country_code == 'UK')) $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/'; // Link no more valid - if ($idprof == 1 && $thirdparty->country_code == 'ES') $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$thirdparty->idprof1; - if ($idprof == 1 && $thirdparty->country_code == 'IN') $url='http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$thirdparty->idprof1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; + if ($idprof == 1 && $thirdparty->country_code == 'FR') { + $url='http://www.societe.com/cgi-bin/search?champs='.$thirdparty->idprof1; // See also http://avis-situation-sirene.insee.fr/ + } + /* + if ($idprof == 1 && ($thirdparty->country_code == 'GB' || $thirdparty->country_code == 'UK')) { + $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/'; // Link no more valid + } + */ + if ($idprof == 1 && $thirdparty->country_code == 'ES') { + $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$thirdparty->idprof1; + } + if ($idprof == 1 && $thirdparty->country_code == 'IN') { + $url='http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$thirdparty->idprof1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; + } + if ($idprof == 1 && $thirdparty->country_code == 'PT') { + $url='http://www.nif.pt/'.$thirdparty->idprof1.'/'; + } - if ($url) return ''.$langs->trans("Check").''; + if ($url) { + return ''.$langs->trans("Check").''; + } } - else - { + else { return $hookmanager->resPrint; } From 97f7de9d3a24fa9bdb87c11b34754983dceb3e22 Mon Sep 17 00:00:00 2001 From: Rui Strecht Date: Wed, 28 Feb 2018 14:36:49 +0000 Subject: [PATCH 14/21] Fixed GB check url --- htdocs/societe/class/societe.class.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9aa872fb064..48c35c7143e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2929,11 +2929,9 @@ class Societe extends CommonObject if ($idprof == 1 && $thirdparty->country_code == 'FR') { $url='http://www.societe.com/cgi-bin/search?champs='.$thirdparty->idprof1; // See also http://avis-situation-sirene.insee.fr/ } - /* if ($idprof == 1 && ($thirdparty->country_code == 'GB' || $thirdparty->country_code == 'UK')) { - $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/'; // Link no more valid + $url='https://beta.companieshouse.gov.uk/company/'.$thirdparty->idprof1; } - */ if ($idprof == 1 && $thirdparty->country_code == 'ES') { $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$thirdparty->idprof1; } @@ -2941,7 +2939,7 @@ class Societe extends CommonObject $url='http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$thirdparty->idprof1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; } if ($idprof == 1 && $thirdparty->country_code == 'PT') { - $url='http://www.nif.pt/'.$thirdparty->idprof1.'/'; + $url='http://www.nif.pt/'.$thirdparty->idprof1; } if ($url) { From 09385574955c56268a1830164f8b87a8046fbd26 Mon Sep 17 00:00:00 2001 From: Rui Strecht Date: Wed, 28 Feb 2018 15:55:24 +0000 Subject: [PATCH 15/21] Added profid validation dictionnary tables --- .../mysql/data/llx_c_profid_validate.sql | 31 +++++++++++++++++++ .../tables/llx_c_profid_validate.key.sql | 21 +++++++++++++ .../mysql/tables/llx_c_profid_validate.sql | 29 +++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 htdocs/install/mysql/data/llx_c_profid_validate.sql create mode 100644 htdocs/install/mysql/tables/llx_c_profid_validate.key.sql create mode 100644 htdocs/install/mysql/tables/llx_c_profid_validate.sql diff --git a/htdocs/install/mysql/data/llx_c_profid_validate.sql b/htdocs/install/mysql/data/llx_c_profid_validate.sql new file mode 100644 index 00000000000..f9a92ff27e8 --- /dev/null +++ b/htdocs/install/mysql/data/llx_c_profid_validate.sql @@ -0,0 +1,31 @@ +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2012 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2012 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2011 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +-- +-- ProfId Validation URL (country code - profid number - validation url) +-- + +INSERT INTO llx_c_profid_validate ( country_code, profid_field_number, validation_url_prefix, validation_url_suffix, active ) VALUES ( 'FR', 1, 'http://www.societe.com/cgi-bin/search?champs=', '', 1); +INSERT INTO llx_c_profid_validate ( country_code, profid_field_number, validation_url_prefix, validation_url_suffix, active ) VALUES ( 'GB', 1, 'https://beta.companieshouse.gov.uk/company/', '', 1); +INSERT INTO llx_c_profid_validate ( country_code, profid_field_number, validation_url_prefix, validation_url_suffix, active ) VALUES ( 'ES', 1, 'http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/', '', 1); +INSERT INTO llx_c_profid_validate ( country_code, profid_field_number, validation_url_prefix, validation_url_suffix, active ) VALUES ( 'IN', 1, 'http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber=', ';&searchBy=TIN&backPage=searchByTin_Inter.jsp', 1); +INSERT INTO llx_c_profid_validate ( country_code, profid_field_number, validation_url_prefix, validation_url_suffix, active ) VALUES ( 'PT', 1, 'http://www.nif.pt/', '', 1); diff --git a/htdocs/install/mysql/tables/llx_c_profid_validate.key.sql b/htdocs/install/mysql/tables/llx_c_profid_validate.key.sql new file mode 100644 index 00000000000..0aac3c7a3e8 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_profid_validate.key.sql @@ -0,0 +1,21 @@ +-- ======================================================================== +-- Copyright (C) 2005 Laurent Destailleur +-- Copyright (C) 2018 Rui Strecht +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ======================================================================== + + +ALTER TABLE llx_c_profid_validate ADD CONSTRAINT uk_profid_validate_fieldnumber_country UNIQUE (country_code, profid_field_number); diff --git a/htdocs/install/mysql/tables/llx_c_profid_validate.sql b/htdocs/install/mysql/tables/llx_c_profid_validate.sql new file mode 100644 index 00000000000..8ee14c03e5f --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_profid_validate.sql @@ -0,0 +1,29 @@ +-- ======================================================================== +-- Copyright (C) 2005 Laurent Destailleur +-- Copyright (C) 2018 Rui Strecht +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ======================================================================== + +create table llx_c_profid_validate +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + country_code varchar(2) NOT NULL, + profid_field_number int(1) DEFAULT 1 NOT NULL, + validation_url_prefix varchar(255) DEFAULT NOT NULL, + validation_url_suffix varchar(255) DEFAULT NULL, + active tinyint DEFAULT 1 NOT NULL +)ENGINE=innodb; + From 3b268b143635366ce8cdbc0324938fa9ca2c2be5 Mon Sep 17 00:00:00 2001 From: Rui Strecht Date: Wed, 28 Feb 2018 16:27:56 +0000 Subject: [PATCH 16/21] Revert "Added profid validation dictionnary tables" This reverts commit 09385574955c56268a1830164f8b87a8046fbd26. --- .../mysql/data/llx_c_profid_validate.sql | 31 ------------------- .../tables/llx_c_profid_validate.key.sql | 21 ------------- .../mysql/tables/llx_c_profid_validate.sql | 29 ----------------- 3 files changed, 81 deletions(-) delete mode 100644 htdocs/install/mysql/data/llx_c_profid_validate.sql delete mode 100644 htdocs/install/mysql/tables/llx_c_profid_validate.key.sql delete mode 100644 htdocs/install/mysql/tables/llx_c_profid_validate.sql diff --git a/htdocs/install/mysql/data/llx_c_profid_validate.sql b/htdocs/install/mysql/data/llx_c_profid_validate.sql deleted file mode 100644 index f9a92ff27e8..00000000000 --- a/htdocs/install/mysql/data/llx_c_profid_validate.sql +++ /dev/null @@ -1,31 +0,0 @@ --- Copyright (C) 2001-2004 Rodolphe Quiedeville --- Copyright (C) 2003 Jean-Louis Bergamo --- Copyright (C) 2004-2012 Laurent Destailleur --- Copyright (C) 2004 Benoit Mortier --- Copyright (C) 2004 Guillaume Delecourt --- Copyright (C) 2005-2012 Regis Houssin --- Copyright (C) 2007 Patrick Raguin --- Copyright (C) 2011 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 --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . - --- --- ProfId Validation URL (country code - profid number - validation url) --- - -INSERT INTO llx_c_profid_validate ( country_code, profid_field_number, validation_url_prefix, validation_url_suffix, active ) VALUES ( 'FR', 1, 'http://www.societe.com/cgi-bin/search?champs=', '', 1); -INSERT INTO llx_c_profid_validate ( country_code, profid_field_number, validation_url_prefix, validation_url_suffix, active ) VALUES ( 'GB', 1, 'https://beta.companieshouse.gov.uk/company/', '', 1); -INSERT INTO llx_c_profid_validate ( country_code, profid_field_number, validation_url_prefix, validation_url_suffix, active ) VALUES ( 'ES', 1, 'http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/', '', 1); -INSERT INTO llx_c_profid_validate ( country_code, profid_field_number, validation_url_prefix, validation_url_suffix, active ) VALUES ( 'IN', 1, 'http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber=', ';&searchBy=TIN&backPage=searchByTin_Inter.jsp', 1); -INSERT INTO llx_c_profid_validate ( country_code, profid_field_number, validation_url_prefix, validation_url_suffix, active ) VALUES ( 'PT', 1, 'http://www.nif.pt/', '', 1); diff --git a/htdocs/install/mysql/tables/llx_c_profid_validate.key.sql b/htdocs/install/mysql/tables/llx_c_profid_validate.key.sql deleted file mode 100644 index 0aac3c7a3e8..00000000000 --- a/htdocs/install/mysql/tables/llx_c_profid_validate.key.sql +++ /dev/null @@ -1,21 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Laurent Destailleur --- Copyright (C) 2018 Rui Strecht --- --- 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 --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . --- --- ======================================================================== - - -ALTER TABLE llx_c_profid_validate ADD CONSTRAINT uk_profid_validate_fieldnumber_country UNIQUE (country_code, profid_field_number); diff --git a/htdocs/install/mysql/tables/llx_c_profid_validate.sql b/htdocs/install/mysql/tables/llx_c_profid_validate.sql deleted file mode 100644 index 8ee14c03e5f..00000000000 --- a/htdocs/install/mysql/tables/llx_c_profid_validate.sql +++ /dev/null @@ -1,29 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Laurent Destailleur --- Copyright (C) 2018 Rui Strecht --- --- 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 --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . --- --- ======================================================================== - -create table llx_c_profid_validate -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - country_code varchar(2) NOT NULL, - profid_field_number int(1) DEFAULT 1 NOT NULL, - validation_url_prefix varchar(255) DEFAULT NOT NULL, - validation_url_suffix varchar(255) DEFAULT NULL, - active tinyint DEFAULT 1 NOT NULL -)ENGINE=innodb; - From 733ca8af7db4957a170713b4f97f447551009bfe Mon Sep 17 00:00:00 2001 From: All3kcis Date: Thu, 1 Mar 2018 14:23:19 +0100 Subject: [PATCH 17/21] Use correct values of eatby and sellby on batchs expeditions Use new table "product_lot" to getting eatby and sellby date --- htdocs/expedition/class/expeditionbatch.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php index a4b3b17a98a..8599617e318 100644 --- a/htdocs/expedition/class/expeditionbatch.class.php +++ b/htdocs/expedition/class/expeditionbatch.class.php @@ -59,14 +59,15 @@ class ExpeditionLineBatch extends CommonObject function fetchFromStock($id_stockdluo) { $sql = "SELECT"; - $sql.= " t.sellby,"; - $sql.= " t.eatby,"; - $sql.= " t.batch,"; - $sql.= " e.fk_entrepot"; + $sql.= " pl.sellby,"; + $sql.= " pl.eatby,"; + $sql.= " pl.batch,"; + $sql.= " ps.fk_entrepot"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_batch as t inner join "; - $sql.= MAIN_DB_PREFIX."product_stock as e on t.fk_product_stock=e.rowid "; - $sql.= " WHERE t.rowid = ".(int) $id_stockdluo; + $sql.= " FROM ".MAIN_DB_PREFIX."product_batch as pb"; + $sql.= " JOIN ".MAIN_DB_PREFIX."product_stock as ps on pb.fk_product_stock=ps.rowid"; + $sql.= ' JOIN '.MAIN_DB_PREFIX."product_lot as pl on pl.batch = pb.batch AND pl.fk_product = ps.fk_product"; + $sql.= " WHERE pb.rowid = ".(int) $id_stockdluo; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); From bf36f008977eccb183d69efbf6be11dbc4fae975 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Mar 2018 17:48:58 +0100 Subject: [PATCH 18/21] Update html.formfile.class.php --- htdocs/core/class/html.formfile.class.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index b7b94e7e644..bd9571fee3b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -851,9 +851,16 @@ class FormFile $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); // Get object entity - preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir).'$/', $filedir, $regs); - $entity = ((! empty($regs[1]) && $regs[1] > 1) ? $regs[1] : $conf->entity); - + if (empty($conf->multicompany->enabled)) + { + $entity = $conf->entity; + } + else + { + preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir).'$/', $filedir, $regs); + $entity = ((! empty($regs[1]) && $regs[1] > 1) ? $regs[1] : $conf->entity); + } + $filterforfilesearch = preg_quote(basename($modulesubdir),'/').'[^\-]+'; $file_list=dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) From 48b578b9f2faf0ddc84a2a15b5f774e2a673d959 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Mar 2018 17:51:21 +0100 Subject: [PATCH 19/21] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 90747f0675b..fb90498cf4c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4495,7 +4495,7 @@ abstract class CommonObject { $extrafields->fetch_name_optionals_label($this->table_element); } - $optionsArray = (! empty($extrafields->attributes[$this->table_element]['label'])?$extrafields->attributes[$this->table_element]['label']:''); + $optionsArray = (! empty($extrafields->attributes[$this->table_element]['label'])?$extrafields->attributes[$this->table_element]['label']:null); } else { From 45418769b196b2c97420357a75fc382f30e3e15f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Mar 2018 18:11:03 +0100 Subject: [PATCH 20/21] Update expeditionbatch.class.php --- htdocs/expedition/class/expeditionbatch.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php index 8599617e318..d94baee2a43 100644 --- a/htdocs/expedition/class/expeditionbatch.class.php +++ b/htdocs/expedition/class/expeditionbatch.class.php @@ -59,14 +59,14 @@ class ExpeditionLineBatch extends CommonObject function fetchFromStock($id_stockdluo) { $sql = "SELECT"; + $sql.= " pb.batch,"; $sql.= " pl.sellby,"; $sql.= " pl.eatby,"; - $sql.= " pl.batch,"; $sql.= " ps.fk_entrepot"; $sql.= " FROM ".MAIN_DB_PREFIX."product_batch as pb"; $sql.= " JOIN ".MAIN_DB_PREFIX."product_stock as ps on pb.fk_product_stock=ps.rowid"; - $sql.= ' JOIN '.MAIN_DB_PREFIX."product_lot as pl on pl.batch = pb.batch AND pl.fk_product = ps.fk_product"; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."product_lot as pl on pl.batch = pb.batch AND pl.fk_product = ps.fk_product"; $sql.= " WHERE pb.rowid = ".(int) $id_stockdluo; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); From fecdff809862b696507ced95a6176c9cdd8c6d4a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Mar 2018 03:17:45 +0100 Subject: [PATCH 21/21] CSS --- htdocs/theme/eldy/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 3cfa1bf01e6..c34f867348a 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3081,7 +3081,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { } .boxstats { padding: 3px; - width: 104px; + width: 121px; } .boxstats130 { width: 158px;