Merge pull request #2836 from FHenry/develop
FIX : Fix problem with multicompany on new feature Product propal merge PDF product
This commit is contained in:
commit
5f26001f53
@ -503,9 +503,8 @@ if ($action == 'create' && !$error)
|
|||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Mode liste
|
//Mode liste
|
||||||
if (($action != 'create' && $action != 'add') || !$error)
|
if (($action != 'create' && $action != 'add') && !$error)
|
||||||
{
|
{
|
||||||
llxHeader();
|
llxHeader();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -671,14 +671,23 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
|
|
||||||
$already_merged[] = $line->fk_product;
|
$already_merged[] = $line->fk_product;
|
||||||
|
|
||||||
|
$product = new Product($this->db);
|
||||||
|
$product->fetch($line->fk_product);
|
||||||
|
|
||||||
|
if ($product->entity!=$conf->entity) {
|
||||||
|
$entity_product_file=$product->entity;
|
||||||
|
} else {
|
||||||
|
$entity_product_file=$conf->entity;
|
||||||
|
}
|
||||||
|
|
||||||
// If PDF is selected and file is not empty
|
// If PDF is selected and file is not empty
|
||||||
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))
|
if (! empty($conf->product->enabled))
|
||||||
$filetomerge_dir = $conf->product->multidir_output[$conf->entity] . '/' . dol_sanitizeFileName($line->product_ref);
|
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file] . '/' . dol_sanitizeFileName($line->product_ref);
|
||||||
elseif (! empty($conf->service->enabled))
|
elseif (! empty($conf->service->enabled))
|
||||||
$filetomerge_dir = $conf->service->multidir_output[$conf->entity] . '/' . dol_sanitizeFileName($line->product_ref);
|
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file] . '/' . dol_sanitizeFileName($line->product_ref);
|
||||||
|
|
||||||
dol_syslog(get_class($this) . ':: upload_dir=' . $filetomerge_dir, LOG_DEBUG);
|
dol_syslog(get_class($this) . ':: upload_dir=' . $filetomerge_dir, LOG_DEBUG);
|
||||||
|
|
||||||
|
|||||||
@ -259,7 +259,7 @@ $formfile = new FormFile($db);
|
|||||||
$companystatic = new Societe($db);
|
$companystatic = new Societe($db);
|
||||||
|
|
||||||
// Mode creation
|
// Mode creation
|
||||||
if ($action == 'create' && empty($mesgs)) {
|
if ($action == 'create' && !$error) {
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
print_fiche_titre($langs->trans('NewBill'));
|
print_fiche_titre($langs->trans('NewBill'));
|
||||||
@ -380,7 +380,7 @@ if ($action == 'create' && empty($mesgs)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mode liste
|
// Mode liste
|
||||||
if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
|
if (($action != 'create' && $action != 'add') && !$error) {
|
||||||
llxHeader();
|
llxHeader();
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|||||||
@ -227,7 +227,7 @@ class Propalmergepdfproduct extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $product_id Id object
|
* @param int $product_id Id object
|
||||||
* @param string $lang Lang string code
|
* @param string $lang Lang string code
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch_by_product($product_id, $lang='')
|
function fetch_by_product($product_id, $lang='')
|
||||||
{
|
{
|
||||||
@ -656,5 +656,4 @@ class PropalmergepdfproductLine
|
|||||||
function __construct() {
|
function __construct() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user