*
* 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
@@ -166,7 +166,7 @@ if (empty($reshook))
if ($object->id > 0) {
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY)) {
//Get difference between old and new delivery date and change lines according to difference
- $date_delivery = dol_mktime(12, 0, 0,
+ $date_delivery = dol_mktime(12, 0, 0,
GETPOST('date_deliverymonth', 'int'),
GETPOST('date_deliveryday', 'int'),
GETPOST('date_deliveryyear', 'int')
@@ -174,7 +174,7 @@ if (empty($reshook))
if (!empty($object->date_livraison) && !empty($date_delivery))
{
//Attempt to get the date without possible hour rounding errors
- $old_date_delivery = dol_mktime(12, 0, 0,
+ $old_date_delivery = dol_mktime(12, 0, 0,
dol_print_date($object->date_livraison, '%m'),
dol_print_date($object->date_livraison, '%d'),
dol_print_date($object->date_livraison, '%Y')
@@ -459,91 +459,91 @@ if (empty($reshook))
$id = $object->create($user);
if ($id > 0)
{
- dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
+ dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
- $classname = ucfirst($subelement);
- $srcobject = new $classname($db);
+ $classname = ucfirst($subelement);
+ $srcobject = new $classname($db);
- dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
- $result = $srcobject->fetch($object->origin_id);
+ dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
+ $result = $srcobject->fetch($object->origin_id);
- if ($result > 0)
+ if ($result > 0)
+ {
+ $lines = $srcobject->lines;
+ if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
{
+ $srcobject->fetch_lines();
$lines = $srcobject->lines;
- if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
- {
- $srcobject->fetch_lines();
- $lines = $srcobject->lines;
- }
-
- $fk_parent_line=0;
- $num=count($lines);
- for ($i=0;$i<$num;$i++)
- {
- $label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
- $desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
-
- // Positive line
- $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
-
- // Date start
- $date_start = false;
- if ($lines[$i]->date_debut_prevue)
- $date_start = $lines[$i]->date_debut_prevue;
- if ($lines[$i]->date_debut_reel)
- $date_start = $lines[$i]->date_debut_reel;
- if ($lines[$i]->date_start)
- $date_start = $lines[$i]->date_start;
-
- // Date end
- $date_end = false;
- if ($lines[$i]->date_fin_prevue)
- $date_end = $lines[$i]->date_fin_prevue;
- if ($lines[$i]->date_fin_reel)
- $date_end = $lines[$i]->date_fin_reel;
- if ($lines[$i]->date_end)
- $date_end = $lines[$i]->date_end;
-
- // Reset fk_parent_line for no child products and special product
- if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
- $fk_parent_line = 0;
- }
-
- // Extrafields
- if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
- $lines[$i]->fetch_optionals();
- $array_options = $lines[$i]->array_options;
- }
-
- $tva_tx = $lines[$i]->tva_tx;
- if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
-
- $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
-
- if ($result > 0) {
- $lineid = $result;
- } else {
- $lineid = 0;
- $error ++;
- break;
- }
-
- // Defined the new fk_parent_line
- if ($result > 0 && $lines[$i]->product_type == 9) {
- $fk_parent_line = $result;
- }
- }
-
- // Hooks
- $parameters = array('objFrom' => $srcobject);
- $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
- // modified by hook
- if ($reshook < 0)
- $error ++;
- } else {
- setEventMessages($srcobject->error, $srcobject->errors, 'errors');
- $error ++;
}
+
+ $fk_parent_line=0;
+ $num=count($lines);
+ for ($i=0;$i<$num;$i++)
+ {
+ $label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
+ $desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
+
+ // Positive line
+ $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
+
+ // Date start
+ $date_start = false;
+ if ($lines[$i]->date_debut_prevue)
+ $date_start = $lines[$i]->date_debut_prevue;
+ if ($lines[$i]->date_debut_reel)
+ $date_start = $lines[$i]->date_debut_reel;
+ if ($lines[$i]->date_start)
+ $date_start = $lines[$i]->date_start;
+
+ // Date end
+ $date_end = false;
+ if ($lines[$i]->date_fin_prevue)
+ $date_end = $lines[$i]->date_fin_prevue;
+ if ($lines[$i]->date_fin_reel)
+ $date_end = $lines[$i]->date_fin_reel;
+ if ($lines[$i]->date_end)
+ $date_end = $lines[$i]->date_end;
+
+ // Reset fk_parent_line for no child products and special product
+ if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
+ $fk_parent_line = 0;
+ }
+
+ // Extrafields
+ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
+ $lines[$i]->fetch_optionals();
+ $array_options = $lines[$i]->array_options;
+ }
+
+ $tva_tx = $lines[$i]->tva_tx;
+ if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
+
+ $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
+
+ if ($result > 0) {
+ $lineid = $result;
+ } else {
+ $lineid = 0;
+ $error ++;
+ break;
+ }
+
+ // Defined the new fk_parent_line
+ if ($result > 0 && $lines[$i]->product_type == 9) {
+ $fk_parent_line = $result;
+ }
+ }
+
+ // Hooks
+ $parameters = array('objFrom' => $srcobject);
+ $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
+ // modified by hook
+ if ($reshook < 0)
+ $error ++;
+ } else {
+ setEventMessages($srcobject->error, $srcobject->errors, 'errors');
+ $error ++;
+ }
} else {
setEventMessages($object->error, $object->errors, 'errors');
$error ++;
@@ -920,8 +920,8 @@ if (empty($reshook))
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
{
- if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
- if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
+ if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
+ if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
}
}
// If price per customer
diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php
index 7afb14a8da2..1337c62da94 100644
--- a/htdocs/comm/propal/class/api_proposals.class.php
+++ b/htdocs/comm/propal/class/api_proposals.class.php
@@ -227,7 +227,7 @@ class Proposals extends DolibarrApi
}
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->propal->getLinesArray();
$result = array();
@@ -255,7 +255,7 @@ class Proposals extends DolibarrApi
$result = $this->propal->fetch($id);
if (! $result) {
- throw new RestException(404, 'Commercial Proposal not found');
+ throw new RestException(404, 'Commercial Proposal not found');
}
if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index a55b4a28172..a2b89dedb11 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1714,9 +1714,9 @@ class Propal extends CommonObject
// multilangs
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) {
- $line = new Product($this->db);
- $line->fetch($objp->fk_product);
- $line->getMultiLangs();
+ $line = new Product($this->db);
+ $line->fetch($objp->fk_product);
+ $line->getMultiLangs();
}
$this->lines[$i] = $line;
@@ -3403,7 +3403,7 @@ class Propal extends CommonObject
{
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
- $line->product_ref='SPECIMEN';
+ $line->product_ref='SPECIMEN';
}
$this->lines[$xnbp]=$line;
@@ -3919,7 +3919,7 @@ class PropaleLigne extends CommonObjectLine
if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0;
if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0;
- // if buy price not defined, define buyprice as configured in margin admin
+ // if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
{
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php
index 96673084580..cb798e2fdd6 100644
--- a/htdocs/comm/propal/contact.php
+++ b/htdocs/comm/propal/contact.php
@@ -170,20 +170,21 @@ if ($object->id > 0)
$morehtmlref.='
'.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer)
{
- if ($action != 'classify')
- //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '';
- $morehtmlref.=' : ';
- if ($action == 'classify') {
- //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.='';
- } else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
- }
+ if ($action != 'classify') {
+ //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '';
+ $morehtmlref.=' : ';
+ }
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php
index eca5ce52fa7..c1719ddbe45 100644
--- a/htdocs/comm/propal/document.php
+++ b/htdocs/comm/propal/document.php
@@ -125,20 +125,21 @@ if ($object->id > 0)
$morehtmlref.='
'.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer)
{
- if ($action != 'classify')
+ if ($action != 'classify') {
//$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '';
- $morehtmlref.=' : ';
- if ($action == 'classify') {
- //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.='';
- } else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
- }
+ $morehtmlref.=' : ';
+ }
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php
index 108a09e7d07..848d707f22f 100644
--- a/htdocs/comm/propal/info.php
+++ b/htdocs/comm/propal/info.php
@@ -86,20 +86,21 @@ if (! empty($conf->projet->enabled))
$morehtmlref.='
'.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer)
{
- if ($action != 'classify')
- //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '';
+ if ($action != 'classify') {
+ //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '';
$morehtmlref.=' : ';
- if ($action == 'classify') {
- //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.='';
- } else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
- }
+ }
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 919ad77168d..46046975f4b 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -279,8 +279,9 @@ $sql.= ' u.login';
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
-if (! empty($extrafields->attributes[$object->table_element]['label']))
+if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
+}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@@ -693,7 +694,7 @@ if ($resql)
print '';
print ' | ';
}
- // Date cloture
+ // Date cloture
if (! empty($arrayfields['p.date_cloture']['checked']))
{
print '';
diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php
index 2a3f0438ad0..7c3d58f64d5 100644
--- a/htdocs/comm/propal/note.php
+++ b/htdocs/comm/propal/note.php
@@ -101,20 +101,21 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.=' '.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer)
{
- if ($action != 'classify')
+ if ($action != 'classify') {
//$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '';
- $morehtmlref.=' : ';
- if ($action == 'classify') {
- //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.='';
- } else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
- }
+ $morehtmlref.=' : ';
+ }
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php
index 4de75dc3225..ccc62ab98c4 100644
--- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php
@@ -29,11 +29,8 @@ if (empty($conf) || ! is_object($conf)) {
exit;
}
-?>
-
-
-\n";
global $user;
@@ -45,51 +42,46 @@ $langs->load("propal");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
-$total=0; $ilink=0;
+$total=0;
+$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
$trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
-?>
- |
- | trans("Proposal"); ?>
- global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)
+ print ' |
';
+ print '| '.$langs->trans("Proposal");
+ if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)
{
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id;
print ' ';
}
- ?>
- |
- getNomUrl(1); ?> |
- ref_client; ?> |
- date, 'day'); ?> |
- rights->propale->lire) {
- $total = $total + $objectlink->total_ht;
- echo price($objectlink->total_ht);
- } ?> |
- getLibStatut(3); ?> |
- id.'&action=dellink&dellinkid='.$key; ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> |
-
-';
+ print ''.$objectlink->getNomUrl(1).' | ';
+ print ''.$objectlink->ref_client.' | ';
+ print ''.dol_print_date($objectlink->date, 'day').' | ';
+ print '';
+ if ($user->rights->propale->lire) {
+ $total = $total + $objectlink->total_ht;
+ echo price($objectlink->total_ht);
+ }
+ print ' | ';
+ print ''.$objectlink->getLibStatut(3).' | ';
+ print 'id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').' | ';
+ print "\n";
}
if (count($linkedObjectBlock) > 1)
{
- ?>
-
- | trans("Total"); ?> |
- |
- |
- |
- |
- |
- |
-
-';
+ print ''.$langs->trans("Total").' | ';
+ print ' | ';
+ print ' | ';
+ print ' | ';
+ print ''.price($total).' | ';
+ print ' | ';
+ print ' | ';
+ print "\n";
}
-?>
-
+print "\n";
diff --git a/htdocs/comm/prospect/recap-prospect.php b/htdocs/comm/prospect/recap-prospect.php
index c1339f7ebe9..192aaccbddf 100644
--- a/htdocs/comm/prospect/recap-prospect.php
+++ b/htdocs/comm/prospect/recap-prospect.php
@@ -34,8 +34,8 @@ if (! empty($conf->facture->enabled)) $langs->load("bills");
$socid = $_GET["socid"];
if ($user->societe_id > 0)
{
- $action = '';
- $socid = $user->societe_id;
+ $action = '';
+ $socid = $user->societe_id;
}
diff --git a/htdocs/comm/recap-client.php b/htdocs/comm/recap-client.php
index 7f16ce6b8b0..0759c47c06c 100644
--- a/htdocs/comm/recap-client.php
+++ b/htdocs/comm/recap-client.php
@@ -34,8 +34,8 @@ if (! empty($conf->facture->enabled)) $langs->load("bills");
$socid = $_GET["socid"];
if ($user->societe_id > 0)
{
- $action = '';
- $socid = $user->societe_id;
+ $action = '';
+ $socid = $user->societe_id;
}