Merge remote-tracking branch 'origin/3.8' into 3.9
Conflicts: htdocs/core/modules/askpricesupplier/doc/doc_generic_askpricesupplier_odt.modules.php htdocs/product/document.php htdocs/societe/commerciaux.php
This commit is contained in:
commit
3b035819a9
@ -239,7 +239,9 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
|||||||
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
||||||
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
||||||
{
|
{
|
||||||
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
|
$format=$conf->global->MAIN_DOC_USE_TIMING;
|
||||||
|
if ($format == '1') $format='%Y%m%d%H%M%S';
|
||||||
|
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -239,7 +239,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
|||||||
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
||||||
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
||||||
{
|
{
|
||||||
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
|
$format=$conf->global->MAIN_DOC_USE_TIMING;
|
||||||
|
if ($format == '1') $format='%Y%m%d%H%M%S';
|
||||||
|
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -240,7 +240,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
|||||||
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
||||||
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
||||||
{
|
{
|
||||||
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
|
$format=$conf->global->MAIN_DOC_USE_TIMING;
|
||||||
|
if ($format == '1') $format='%Y%m%d%H%M%S';
|
||||||
|
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -449,7 +449,9 @@ class doc_generic_project_odt extends ModelePDFProjects
|
|||||||
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
||||||
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
||||||
{
|
{
|
||||||
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
|
$format=$conf->global->MAIN_DOC_USE_TIMING;
|
||||||
|
if ($format == '1') $format='%Y%m%d%H%M%S';
|
||||||
|
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -273,7 +273,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
|||||||
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
||||||
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
||||||
{
|
{
|
||||||
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
|
$format=$conf->global->MAIN_DOC_USE_TIMING;
|
||||||
|
if ($format == '1') $format='%Y%m%d%H%M%S';
|
||||||
|
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -685,21 +685,39 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
if (count($filetomerge->lines) > 0) {
|
if (count($filetomerge->lines) > 0) {
|
||||||
foreach ( $filetomerge->lines as $linefile ) {
|
foreach ( $filetomerge->lines as $linefile ) {
|
||||||
if (! empty($linefile->id) && ! empty($linefile->file_name)) {
|
if (! empty($linefile->id) && ! empty($linefile->file_name)) {
|
||||||
if (! empty($conf->product->enabled))
|
|
||||||
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file] . '/' . dol_sanitizeFileName($line->product_ref);
|
|
||||||
elseif (! empty($conf->service->enabled))
|
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||||
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file] . '/' . dol_sanitizeFileName($line->product_ref);
|
{
|
||||||
|
if (! empty($conf->product->enabled)) {
|
||||||
|
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file] . '/' . get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos";
|
||||||
|
} elseif (! empty($conf->service->enabled)) {
|
||||||
|
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file] . '/' . get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! empty($conf->product->enabled)) {
|
||||||
|
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file] . '/' . get_exdir(0,0,0,0,$product,'product') . dol_sanitizeFileName($product->ref);
|
||||||
|
} elseif (! empty($conf->service->enabled)) {
|
||||||
|
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file] . '/' . get_exdir(0,0,0,0,$product,'product') . dol_sanitizeFileName($product->ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this) . ':: upload_dir=' . $filetomerge_dir, LOG_DEBUG);
|
dol_syslog(get_class($this) . ':: upload_dir=' . $filetomerge_dir, LOG_DEBUG);
|
||||||
|
|
||||||
$infile = $filetomerge_dir . '/' . $linefile->file_name;
|
$infile = $filetomerge_dir . '/' . $linefile->file_name;
|
||||||
if (is_file($infile)) {
|
if (file_exists($infile) && is_readable($infile)) {
|
||||||
$pagecount = $pdf->setSourceFile($infile);
|
$pagecount = $pdf->setSourceFile($infile);
|
||||||
for($i = 1; $i <= $pagecount; $i ++) {
|
for($i = 1; $i <= $pagecount; $i ++) {
|
||||||
$tplidx = $pdf->ImportPage($i);
|
$tplIdx = $pdf->importPage(1);
|
||||||
$s = $pdf->getTemplatesize($tplidx);
|
if ($tplIdx!==false) {
|
||||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
$s = $pdf->getTemplatesize($tplIdx);
|
||||||
$pdf->useTemplate($tplidx);
|
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||||
|
$pdf->useTemplate($tplIdx);
|
||||||
|
} else {
|
||||||
|
setEventMessages(null, array($infile.' cannot be added, probably protected PDF'),'warnings');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -709,10 +727,6 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//exit;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$pdf->Close();
|
$pdf->Close();
|
||||||
|
|
||||||
$pdf->Output($file,'F');
|
$pdf->Output($file,'F');
|
||||||
|
|||||||
@ -209,9 +209,15 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
|||||||
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
|
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
|
||||||
// Get extension (ods or odt)
|
// Get extension (ods or odt)
|
||||||
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
||||||
|
if ( ! empty($conf->global->MAIN_DOC_USE_OBJECT_THIRDPARTY_NAME))
|
||||||
|
{
|
||||||
|
$newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)).'-'.$newfiletmp;
|
||||||
|
}
|
||||||
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
||||||
{
|
{
|
||||||
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
|
$format=$conf->global->MAIN_DOC_USE_TIMING;
|
||||||
|
if ($format == '1') $format='%Y%m%d%H%M%S';
|
||||||
|
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -273,7 +273,9 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
|
|||||||
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
||||||
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
||||||
{
|
{
|
||||||
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
|
$format=$conf->global->MAIN_DOC_USE_TIMING;
|
||||||
|
if ($format == '1') $format='%Y%m%d%H%M%S';
|
||||||
|
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -117,17 +117,20 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
// Define output language
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang='';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
|
||||||
if (! empty($newlang))
|
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate("",$conf);
|
// Define output language
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
$result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs);
|
|
||||||
|
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
exit;
|
exit;
|
||||||
@ -143,17 +146,20 @@ if (empty($reshook))
|
|||||||
$result = $object->setDraft($user);
|
$result = $object->setDraft($user);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
// Define output language
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang='';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
|
||||||
if (! empty($newlang))
|
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate("",$conf);
|
// Define output language
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
$result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->model:GETPOST('model','apha'), $outputlangs);
|
|
||||||
|
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@ -797,3 +797,17 @@ ALTER TABLE llx_societe_remise_except MODIFY COLUMN description text NOT NULL;
|
|||||||
update llx_opensurvey_sondage set format = 'D' where format = 'D+';
|
update llx_opensurvey_sondage set format = 'D' where format = 'D+';
|
||||||
update llx_opensurvey_sondage set format = 'A' where format = 'A+';
|
update llx_opensurvey_sondage set format = 'A' where format = 'A+';
|
||||||
|
|
||||||
|
|
||||||
|
--Deal with holidays_user that do not have rowid
|
||||||
|
-- Disabled: too dangerous patch. rowid is a primary key. How is it possible to have no rowid ?
|
||||||
|
--CREATE TABLE llx_holiday_users_tmp
|
||||||
|
--(
|
||||||
|
-- rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
-- fk_user integer NOT NULL,
|
||||||
|
-- fk_type integer NOT NULL,
|
||||||
|
-- nb_holiday real NOT NULL DEFAULT '0'
|
||||||
|
--) ENGINE=innodb;
|
||||||
|
--INSERT INTO llx_holiday_users_tmp(fk_user,fk_type,nb_holiday) SELECT fk_user,fk_type,nb_holiday FROM llx_holiday_users;
|
||||||
|
--DROP TABLE llx_holiday_users;
|
||||||
|
--ALTER TABLE llx_holiday_users_tmp RENAME TO llx_holiday_users;
|
||||||
|
|
||||||
|
|||||||
@ -21,5 +21,4 @@ CREATE TABLE llx_holiday_users
|
|||||||
fk_user integer NOT NULL,
|
fk_user integer NOT NULL,
|
||||||
fk_type integer NOT NULL,
|
fk_type integer NOT NULL,
|
||||||
nb_holiday real NOT NULL DEFAULT '0'
|
nb_holiday real NOT NULL DEFAULT '0'
|
||||||
)
|
) ENGINE=innodb;
|
||||||
ENGINE=innodb;
|
|
||||||
@ -216,7 +216,6 @@ if ($object->id)
|
|||||||
$param = '&id=' . $object->id;
|
$param = '&id=' . $object->id;
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||||
|
|
||||||
|
|
||||||
// Merge propal PDF document PDF files
|
// Merge propal PDF document PDF files
|
||||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
||||||
{
|
{
|
||||||
@ -231,8 +230,14 @@ if ($object->id)
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$', 'name', SORT_ASC, 1);
|
$filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$', 'name', SORT_ASC, 1);
|
||||||
|
|
||||||
|
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs
|
||||||
|
{
|
||||||
|
$filearray = dol_dir_list($upload_dirold, "files", 0, '', '\.meta$', 'name', SORT_ASC, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// For each file build select list with PDF extention
|
// For each file build select list with PDF extention
|
||||||
if (count($filearray) > 0)
|
if (count($filearray) > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
|
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
|
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
@ -1630,10 +1630,19 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
$reparray=array();
|
$reparray=array();
|
||||||
|
|
||||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.email";
|
$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.email";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE u.rowid = sc.fk_user AND sc.fk_soc =".$this->id;
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
|
||||||
$sql.= " AND entity in (0, ".$conf->entity.")";
|
{
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
|
$sql.= " WHERE ((ug.fk_user = sc.fk_user";
|
||||||
|
$sql.= " AND ug.entity = ".$conf->entity.")";
|
||||||
|
$sql.= " OR u.admin = 1)";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$sql.= " WHERE entity in (0, ".$conf->entity.")";
|
||||||
|
|
||||||
|
$sql.= " AND u.rowid = sc.fk_user AND sc.fk_soc =".$this->id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -137,12 +137,26 @@ if (! empty($socid))
|
|||||||
print '<tr><td>'.$langs->trans("SalesRepresentatives").'</td>';
|
print '<tr><td>'.$langs->trans("SalesRepresentatives").'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
|
|
||||||
$sql = "SELECT u.rowid, u.lastname, u.firstname";
|
$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
$sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
|
||||||
|
{
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
|
}
|
||||||
$sql .= " WHERE sc.fk_soc =".$object->id;
|
$sql .= " WHERE sc.fk_soc =".$object->id;
|
||||||
$sql .= " AND sc.fk_user = u.rowid";
|
$sql .= " AND sc.fk_user = u.rowid";
|
||||||
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
|
||||||
|
{
|
||||||
|
$sql.= " AND ((ug.fk_user = sc.fk_user";
|
||||||
|
$sql.= " AND ug.entity = ".$conf->entity.")";
|
||||||
|
$sql.= " OR u.admin = 1)";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$sql.= " AND u.entity IN (0,".$conf->entity.")";
|
||||||
|
|
||||||
$sql .= " ORDER BY u.lastname ASC ";
|
$sql .= " ORDER BY u.lastname ASC ";
|
||||||
|
|
||||||
dol_syslog('societe/commerciaux.php::list salesman sql = '.$sql,LOG_DEBUG);
|
dol_syslog('societe/commerciaux.php::list salesman sql = '.$sql,LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -206,9 +220,9 @@ if (! empty($socid))
|
|||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
|
||||||
{
|
{
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
|
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
$sql.= " WHERE (ug.fk_user = u.rowid";
|
$sql.= " WHERE ((ug.fk_user = u.rowid";
|
||||||
$sql.= " AND ug.entity = ".$conf->entity.")";
|
$sql.= " AND ug.entity = ".$conf->entity.")";
|
||||||
$sql.= " OR u.admin = 1";
|
$sql.= " OR u.admin = 1)";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||||
|
|||||||
@ -2303,7 +2303,18 @@ else
|
|||||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if (! empty($object->email))
|
$at_least_one_email_contact = false;
|
||||||
|
$TContact = $object->contact_array_objects();
|
||||||
|
foreach ($TContact as &$contact)
|
||||||
|
{
|
||||||
|
if (!empty($contact->email))
|
||||||
|
{
|
||||||
|
$at_least_one_email_contact = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($object->email) || $at_least_one_email_contact)
|
||||||
{
|
{
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendMail').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendMail').'</a></div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user