Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
f0c9cd3acc
@ -631,7 +631,7 @@ print "<tr class=\"liste_titre\">\n";
|
||||
print " <td>".$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Value")."</td>\n";
|
||||
print "</tr>\n";
|
||||
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->dir_output."</td>\n</tr>\n";
|
||||
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->multidir_output[$conf->entity]."</td>\n</tr>\n";
|
||||
print "</table>\n<br>";
|
||||
|
||||
|
||||
|
||||
@ -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')
|
||||
{
|
||||
|
||||
@ -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 '</td>';
|
||||
print '<td width="16" align="center" class="nobordernopadding">';
|
||||
$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 '</td></tr></table>';
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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))
|
||||
{
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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 '<td width="16" align="right" class="nobordernopadding">';
|
||||
$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 '</td></tr></table>';
|
||||
@ -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 '</td>';
|
||||
print '<td width="16" align="center" class="nobordernopadding">';
|
||||
$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 '</td></tr></table>';
|
||||
|
||||
@ -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 '<td width="16" align="right" class="nobordernopadding">';
|
||||
$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 '</td></tr></table>';
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -4514,7 +4514,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']:null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -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";
|
||||
|
||||
|
||||
@ -742,7 +742,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."'";
|
||||
|
||||
@ -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
|
||||
{
|
||||
@ -848,6 +851,17 @@ class FormFile
|
||||
$out='';
|
||||
$this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array());
|
||||
|
||||
// Get object 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)
|
||||
@ -901,7 +915,7 @@ class FormFile
|
||||
}
|
||||
|
||||
// Download
|
||||
$tmpout.= '<li class="nowrap"><a class="pictopreview nowrap" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||
$tmpout.= '<li class="nowrap"><a class="pictopreview nowrap" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($relativepath).'"';
|
||||
$mime=dol_mimetype($relativepath,'',0);
|
||||
if (preg_match('/text/',$mime)) $tmpout.= ' target="_blank"';
|
||||
$tmpout.= '>';
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -2152,10 +2152,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))
|
||||
@ -2200,10 +2200,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))
|
||||
@ -2367,13 +2367,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')
|
||||
{
|
||||
@ -2407,7 +2407,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))
|
||||
{
|
||||
@ -2462,14 +2462,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;
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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' => '}'
|
||||
|
||||
@ -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
|
||||
|
||||
@ -67,7 +67,7 @@ if ($conf->multicompany->enabled) {
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\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)
|
||||
{
|
||||
|
||||
@ -1272,7 +1272,7 @@ if ($action == 'create')
|
||||
print '<td align="center">';
|
||||
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 '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
}
|
||||
|
||||
@ -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.= " pb.batch,";
|
||||
$sql.= " pl.sellby,";
|
||||
$sql.= " pl.eatby,";
|
||||
$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.= ' 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);
|
||||
$resql=$this->db->query($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
|
||||
) ENGINE=InnoDB;
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.= ")";
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -2897,20 +2920,33 @@ 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='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;
|
||||
}
|
||||
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 '<a target="_blank" href="'.$url.'">'.$langs->trans("Check").'</a>';
|
||||
if ($url) {
|
||||
return '<a target="_blank" href="'.$url.'">'.$langs->trans("Check").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
return $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
|
||||
@ -3081,7 +3081,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
|
||||
}
|
||||
.boxstats {
|
||||
padding: 3px;
|
||||
width: 104px;
|
||||
width: 121px;
|
||||
}
|
||||
.boxstats130 {
|
||||
width: 158px;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user