Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
Scrutinizer Auto-Fixer 2017-10-16 06:47:05 +00:00
parent f853dbc152
commit bd5bffa72c
19 changed files with 8785 additions and 8785 deletions

View File

@ -33,12 +33,12 @@ include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
*/
class lettering extends BookKeeping
{
/**
* lettrageTiers
*
* @param int $socid Thirdparty id
* @return int <0 if KO, >0 if OK
*/
/**
* lettrageTiers
*
* @param int $socid Thirdparty id
* @return int <0 if KO, >0 if OK
*/
public function lettrageTiers($socid) {
$db = $this->db;
@ -121,7 +121,7 @@ class lettering extends BookKeeping
/**
Prise en charge des lettering complexe avec prelevment , virement
*/
*/
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";

View File

@ -25,119 +25,119 @@ include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class
*/
class Dolistore
{
// params
public $start; // beginning of pagination
public $end; // end of pagination
public $per_page; // pagination: display per page
public $categorie; // the current categorie
public $search; // the search keywords
// params
public $start; // beginning of pagination
public $end; // end of pagination
public $per_page; // pagination: display per page
public $categorie; // the current categorie
public $search; // the search keywords
// setups
public $url; // the url of this page
public $shop_url; // the url of the shop
public $vat_rate; // the vat rate used in the shop (prices are provided without vat)
public $lang; // the integer representing the lang in the store
public $debug_api; // usefull if no dialog
// setups
public $url; // the url of this page
public $shop_url; // the url of the shop
public $vat_rate; // the vat rate used in the shop (prices are provided without vat)
public $lang; // the integer representing the lang in the store
public $debug_api; // usefull if no dialog
/**
* Constructor
*/
function __construct()
{
global $conf, $langs;
/**
* Constructor
*/
function __construct()
{
global $conf, $langs;
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
$this->vat_rate = 1.2; // 20% de TVA
$this->debug_api = false;
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
$this->vat_rate = 1.2; // 20% de TVA
$this->debug_api = false;
$langtmp = explode('_', $langs->defaultlang);
$lang = $langtmp[0];
$lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
$this->lang = $lang_array[$lang];
}
$langtmp = explode('_', $langs->defaultlang);
$lang = $langtmp[0];
$lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
$this->lang = $lang_array[$lang];
}
/**
* Load data from remote Dolistore market place.
* This fills ->categories
*
* @param array $options Options
* @return void
*/
function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
{
global $conf, $langs;
/**
* Load data from remote Dolistore market place.
* This fills ->categories
*
* @param array $options Options
* @return void
*/
function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
{
global $conf, $langs;
$this->start = $options['start'];
$this->end = $options['end'];
$this->per_page = $options['per_page'];
$this->categorie = $options['categorie'];
$this->search = $options['search'];
$this->start = $options['start'];
$this->end = $options['end'];
$this->per_page = $options['per_page'];
$this->categorie = $options['categorie'];
$this->search = $options['search'];
if ($this->end == 0) {
$this->end = $this->per_page;
}
if ($this->end == 0) {
$this->end = $this->per_page;
}
try {
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
try {
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
// Here we set the option array for the Webservice : we want products resources
$opt = array();
$opt['resource'] = 'products';
// Here we set the option array for the Webservice : we want products resources
$opt = array();
$opt['resource'] = 'products';
// make a search to limit the id returned.
if ($this->search != '') {
$opt2 = array();
$opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang;
// Call
$xml = $this->api->get($opt2);
$products = array();
foreach ($xml->products->children() as $product) {
$products[] = (int) $product['id'];
}
$opt['filter[id]'] = '['.implode('|', $products).']';
} elseif ($this->categorie != 0) {
$opt2 = array();
$opt2['resource'] = 'categories';
$opt2['id'] = $this->categorie;
// Call
$xml = $this->api->get($opt2);
$products = array();
foreach ($xml->category->associations->products->children() as $product) {
$products[] = (int) $product->id;
}
$opt['filter[id]'] = '['.implode('|', $products).']';
}
$opt['display'] = '[id,name,id_default_image,id_category_default,reference,price,condition,show_price,date_add,date_upd,description_short,description,module_version,dolibarr_min,dolibarr_max]';
$opt['sort'] = 'id_desc';
$opt['filter[active]'] = '[1]';
$opt['limit'] = "$this->start,$this->end";
// make a search to limit the id returned.
if ($this->search != '') {
$opt2 = array();
$opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang;
// Call
$xml = $this->api->get($opt2);
$products = array();
foreach ($xml->products->children() as $product) {
$products[] = (int) $product['id'];
}
$opt['filter[id]'] = '['.implode('|', $products).']';
} elseif ($this->categorie != 0) {
$opt2 = array();
$opt2['resource'] = 'categories';
$opt2['id'] = $this->categorie;
// Call
$xml = $this->api->get($opt2);
$products = array();
foreach ($xml->category->associations->products->children() as $product) {
$products[] = (int) $product->id;
}
$opt['filter[id]'] = '['.implode('|', $products).']';
}
$opt['display'] = '[id,name,id_default_image,id_category_default,reference,price,condition,show_price,date_add,date_upd,description_short,description,module_version,dolibarr_min,dolibarr_max]';
$opt['sort'] = 'id_desc';
$opt['filter[active]'] = '[1]';
$opt['limit'] = "$this->start,$this->end";
// $opt['filter[id]'] contais list of product id that are result of search
// Call API to get the detail
$xml = $this->api->get($opt);
$this->products = $xml->products->children();
// Call API to get the detail
$xml = $this->api->get($opt);
$this->products = $xml->products->children();
// Here we set the option array for the Webservice : we want categories resources
$opt = array();
$opt['resource'] = 'categories';
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
$opt['sort'] = 'id_asc';
// Call
$xml = $this->api->get($opt);
$this->categories = $xml->categories->children();
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) die('Bad ID');
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
}
}
// Here we set the option array for the Webservice : we want categories resources
$opt = array();
$opt['resource'] = 'categories';
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
$opt['sort'] = 'id_asc';
// Call
$xml = $this->api->get($opt);
$this->categories = $xml->categories->children();
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) die('Bad ID');
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
}
}
/**
* Return tree of Dolistore categories. $this->categories must have been loaded before.
@ -145,199 +145,199 @@ class Dolistore
* @param int $parent Id of parent category
* @return string
*/
function get_categories($parent = 0)
{
if (!isset($this->categories)) die('not possible');
if ($parent != 0) {
$html = '<ul>';
} else {
$html = '';
}
function get_categories($parent = 0)
{
if (!isset($this->categories)) die('not possible');
if ($parent != 0) {
$html = '<ul>';
} else {
$html = '';
}
$nbofcateg = count($this->categories);
for ($i = 0; $i < $nbofcateg; $i++)
{
$cat = $this->categories[$i];
if ($cat->is_root_category == 1 && $parent == 0) {
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"'
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
$select = ($cat->id == $this->categorie) ? ' selected' : '';
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" '
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} else {
$nbofcateg = count($this->categories);
for ($i = 0; $i < $nbofcateg; $i++)
{
$cat = $this->categories[$i];
if ($cat->is_root_category == 1 && $parent == 0) {
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"'
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
$select = ($cat->id == $this->categorie) ? ' selected' : '';
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" '
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} else {
}
}
}
}
if ($html == '<ul>') {
return '';
}
if ($parent != 0) {
return $html.'</ul>';
} else {
return $html;
}
}
if ($html == '<ul>') {
return '';
}
if ($parent != 0) {
return $html.'</ul>';
} else {
return $html;
}
}
/**
* Return list of product formated for output
*
* @return string HTML output
*/
function get_products()
{
global $langs, $conf;
$html = "";
$parity = "pair";
$last_month = time() - (30 * 24 * 60 * 60);
foreach ($this->products as $product) {
$parity = ($parity == "impair") ? 'pair' : 'impair';
/**
* Return list of product formated for output
*
* @return string HTML output
*/
function get_products()
{
global $langs, $conf;
$html = "";
$parity = "pair";
$last_month = time() - (30 * 24 * 60 * 60);
foreach ($this->products as $product) {
$parity = ($parity == "impair") ? 'pair' : 'impair';
// check new product ?
$newapp = '';
if ($last_month < strtotime($product->date_add)) {
$newapp .= '<span class="newApp">'.$langs->trans('New').'</span> ';
}
// check new product ?
$newapp = '';
if ($last_month < strtotime($product->date_add)) {
$newapp .= '<span class="newApp">'.$langs->trans('New').'</span> ';
}
// check updated ?
if ($last_month < strtotime($product->date_upd) && $newapp == '') {
$newapp .= '<span class="updatedApp">'.$langs->trans('Updated').'</span> ';
}
// check updated ?
if ($last_month < strtotime($product->date_upd) && $newapp == '') {
$newapp .= '<span class="updatedApp">'.$langs->trans('Updated').'</span> ';
}
// add image or default ?
if ($product->id_default_image != '') {
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image;
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else {
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
}
// add image or default ?
if ($product->id_default_image != '') {
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image;
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else {
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
}
// free or pay ?
if ($product->price > 0) {
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).'&nbsp;&euro;</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
} else {
$price = '<h3>'.$langs->trans('Free').'</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
$download_link.= '<br><br><a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
}
// free or pay ?
if ($product->price > 0) {
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).'&nbsp;&euro;</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
} else {
$price = '<h3>'.$langs->trans('Free').'</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
$download_link.= '<br><br><a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
}
//checking versions
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
//compatible
$version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = '';
} else {
//never compatible, module expired
$version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = 'NotCompatible';
}
} else {
//need update
$version = '<span class="compatibleafterupdate">'.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = 'NotCompatible';
}
//checking versions
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
//compatible
$version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = '';
} else {
//never compatible, module expired
$version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = 'NotCompatible';
}
} else {
//need update
$version = '<span class="compatibleafterupdate">'.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = 'NotCompatible';
}
//.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a>
//.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a>
//output template
$html .= '<tr class="app '.$parity.' '.$compatible.'">
//output template
$html .= '<tr class="app '.$parity.' '.$compatible.'">
<td align="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
<td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang]
.'<br/><small>'.$version.'</small></h2>
.'<br/><small>'.$version.'</small></h2>
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
<td class="margeCote" align="center">'.$price.'
</td>
<td class="margeCote">'.$download_link.'</td>
</tr>';
}
return $html;
}
}
return $html;
}
function get_previous_link($text = '<<')
{
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
}
function get_previous_link($text = '<<')
{
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
}
function get_next_link($text = '>>')
{
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
}
function get_next_link($text = '>>')
{
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
}
function get_previous_url()
{
$param_array = array();
if ($this->start < $this->per_page) {
$sub = 0;
} else {
$sub = $this->per_page;
}
$param_array['start'] = $this->start - $sub;
$param_array['end'] = $this->end - $sub;
if ($this->categorie != 0) {
$param_array['categorie'] = $this->categorie;
}
$param = http_build_query($param_array);
return $this->url."&".$param;
}
function get_previous_url()
{
$param_array = array();
if ($this->start < $this->per_page) {
$sub = 0;
} else {
$sub = $this->per_page;
}
$param_array['start'] = $this->start - $sub;
$param_array['end'] = $this->end - $sub;
if ($this->categorie != 0) {
$param_array['categorie'] = $this->categorie;
}
$param = http_build_query($param_array);
return $this->url."&".$param;
}
function get_next_url()
{
$param_array = array();
if (count($this->products) < $this->per_page) {
$add = 0;
} else {
$add = $this->per_page;
}
$param_array['start'] = $this->start + $add;
$param_array['end'] = $this->end + $add;
if ($this->categorie != 0) {
$param_array['categorie'] = $this->categorie;
}
$param = http_build_query($param_array);
return $this->url."&".$param;
}
function get_next_url()
{
$param_array = array();
if (count($this->products) < $this->per_page) {
$add = 0;
} else {
$add = $this->per_page;
}
$param_array['start'] = $this->start + $add;
$param_array['end'] = $this->end + $add;
if ($this->categorie != 0) {
$param_array['categorie'] = $this->categorie;
}
$param = http_build_query($param_array);
return $this->url."&".$param;
}
function version_compare($v1, $v2)
{
$v1 = explode('.', $v1);
$v2 = explode('.', $v2);
$ret = 0;
$level = 0;
$count1 = count($v1);
$count2 = count($v2);
$maxcount = max($count1, $count2);
while ($level < $maxcount) {
$operande1 = isset($v1[$level]) ? $v1[$level] : 'x';
$operande2 = isset($v2[$level]) ? $v2[$level] : 'x';
$level++;
if (strtoupper($operande1) == 'X' || strtoupper($operande2) == 'X' || $operande1 == '*' || $operande2 == '*') {
break;
}
if ($operande1 < $operande2) {
$ret = -$level;
break;
}
if ($operande1 > $operande2) {
$ret = $level;
break;
}
}
//print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'<br>'."\n";
return $ret;
}
function version_compare($v1, $v2)
{
$v1 = explode('.', $v1);
$v2 = explode('.', $v2);
$ret = 0;
$level = 0;
$count1 = count($v1);
$count2 = count($v2);
$maxcount = max($count1, $count2);
while ($level < $maxcount) {
$operande1 = isset($v1[$level]) ? $v1[$level] : 'x';
$operande2 = isset($v2[$level]) ? $v2[$level] : 'x';
$level++;
if (strtoupper($operande1) == 'X' || strtoupper($operande2) == 'X' || $operande1 == '*' || $operande2 == '*') {
break;
}
if ($operande1 < $operande2) {
$ret = -$level;
break;
}
if ($operande1 > $operande2) {
$ret = $level;
break;
}
}
//print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'<br>'."\n";
return $ret;
}
}

View File

@ -85,7 +85,7 @@ if (! $sortorder) $sortorder="ASC";
$socid=0;
if ($user->societe_id > 0)
{
//$socid = $user->societe_id;
//$socid = $user->societe_id;
accessforbidden();
}
@ -94,14 +94,14 @@ $search_all=trim(GETPOST("search_all",'alpha'));
$search=array();
foreach($object->fields as $key => $val)
{
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
}
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach($object->fields as $key => $val)
{
if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
}
// Definition of fields for list
@ -109,15 +109,15 @@ $arrayfields=array();
foreach($object->fields as $key => $val)
{
// If $val['visible']==0, then we never show the field
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
@ -136,32 +136,32 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
foreach($object->fields as $key => $val)
{
$search[$key]='';
}
$toselect='';
$search_array_options=array();
}
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
{
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
}
// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
foreach($object->fields as $key => $val)
{
$search[$key]='';
}
$toselect='';
$search_array_options=array();
}
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
{
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
}
// Mass actions
$objectclass='EmailSenderProfile';
$objectlabel='EmailSenderProfile';
$permtoread = $user->admin;
$permtodelete = $user->admin;
$uploaddir = $conf->admin->dir_output.'/senderprofiles';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
// Mass actions
$objectclass='EmailSenderProfile';
$objectlabel='EmailSenderProfile';
$permtoread = $user->admin;
$permtodelete = $user->admin;
$uploaddir = $conf->admin->dir_output.'/senderprofiles';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -196,7 +196,7 @@ dol_fiche_head($head, 'senderprofiles', '', -1);
$sql = 'SELECT ';
foreach($object->fields as $key => $val)
{
$sql.='t.'.$key.', ';
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
@ -217,16 +217,16 @@ if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_a
// Add where from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey];
$mode_search=0;
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
}
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey];
$mode_search=0;
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
}
}
// Add where from hooks
$parameters=array();
@ -263,8 +263,8 @@ dol_syslog($script_file, LOG_DEBUG);
$resql=$db->query($sql);
if (! $resql)
{
dol_print_error($db);
exit;
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
@ -272,10 +272,10 @@ $num = $db->num_rows($resql);
// Direct jump if only one record found
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/monmodule/emailsenderprofile_card.php?id='.$id);
exit;
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/monmodule/emailsenderprofile_card.php?id='.$id);
exit;
}
@ -301,21 +301,21 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
foreach($search as $key => $val)
{
$param.= '&search_'.$key.'='.urlencode($search[$key]);
$param.= '&search_'.$key.'='.urlencode($search[$key]);
}
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->monmodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array();
@ -347,7 +347,7 @@ if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
print '</div>';
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
@ -363,35 +363,35 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
print '<tr class="liste_titre">';
foreach($object->fields as $key => $val)
{
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key];
print '<td class="liste_titre'.($align?' '.$align:'').'">';
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key]))
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$searchclass='';
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
}
print '</td>';
}
}
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key];
print '<td class="liste_titre'.($align?' '.$align:'').'">';
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key]))
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$searchclass='';
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
}
print '</td>';
}
}
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
@ -400,12 +400,12 @@ print $hookmanager->resPrint;
// Rest of fields search
foreach($object->fields as $key => $val)
{
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
}
// Action column
print '<td class="liste_titre" align="right">';
@ -420,25 +420,25 @@ print '</tr>'."\n";
print '<tr class="liste_titre">';
foreach($object->fields as $key => $val)
{
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
}
}
}
}
// Hook fields
@ -448,12 +448,12 @@ print $hookmanager->resPrint;
// Rest of fields title
foreach($object->fields as $key => $val)
{
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
}
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
print '</tr>'."\n";
@ -463,7 +463,7 @@ print '</tr>'."\n";
$needToFetchEachLine=0;
foreach ($extrafields->attribute_computed as $key => $val)
{
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
}
@ -473,42 +473,42 @@ $i=0;
$totalarray=array();
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
if (empty($obj)) break; // Should not happen
$obj = $db->fetch_object($resql);
if (empty($obj)) break; // Should not happen
// Store properties in $object
// Store properties in $object
$object->id = $obj->rowid;
foreach($object->fields as $key => $val)
{
if (isset($obj->$key)) $object->$key = $obj->$key;
}
// Show here line of result
print '<tr class="oddeven">';
foreach($object->fields as $key => $val)
{
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td'.($align?' class="'.$align.'"':'').'>';
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
elseif ($key == 'ref') print $object->getNomUrl(1, '', 0, '', 1);
elseif ($key == 'status') print $object->getLibStatut(3);
else print $obj->$key;
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
{
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
$totalarray['val']['t.'.$key] += $obj->$key;
}
}
}
// Extra fields
// Show here line of result
print '<tr class="oddeven">';
foreach($object->fields as $key => $val)
{
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td'.($align?' class="'.$align.'"':'').'>';
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
elseif ($key == 'ref') print $object->getNomUrl(1, '', 0, '', 1);
elseif ($key == 'status') print $object->getLibStatut(3);
else print $obj->$key;
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
{
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
$totalarray['val']['t.'.$key] += $obj->$key;
}
}
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
@ -522,86 +522,86 @@ while ($i < min($num, $limit))
$tmpkey='options_'.$key;
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
{
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
$totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
}
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
{
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
$totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
}
}
}
}
// Fields from hook
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Rest of fields
foreach($object->fields as $key => $val)
{
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td'.($align?' class="'.$align.'"':'').'>';
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
elseif ($key == 'status') print $object->getLibStatut(3);
else print $obj->$key;
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
{
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
$totalarray['val']['t.'.$key] += $obj->$key;
}
}
}
// Action column
print '<td class="nowrap" align="center">';
print $hookmanager->resPrint;
// Rest of fields
foreach($object->fields as $key => $val)
{
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td'.($align?' class="'.$align.'"':'').'>';
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
elseif ($key == 'status') print $object->getLibStatut(3);
else print $obj->$key;
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
{
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
$totalarray['val']['t.'.$key] += $obj->$key;
}
}
}
// Action column
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
}
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['nbfield']++;
print '</tr>';
print '</tr>';
$i++;
$i++;
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
// If no record found
if ($num == 0)
{
$colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
$colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
@ -618,25 +618,25 @@ print '</form>'."\n";
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
{
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$formfile = new FormFile($db);
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$formfile = new FormFile($db);
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction;
$genallowed=$user->rights->monmodule->read;
$delallowed=$user->rights->monmodule->read;
$filedir=$diroutputmassaction;
$genallowed=$user->rights->monmodule->read;
$delallowed=$user->rights->monmodule->read;
print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
}
dol_fiche_end();

View File

@ -36,7 +36,7 @@ if (! $user->admin) accessforbidden();
if (! ((GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)))
{
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
}
$error=0;
@ -71,33 +71,33 @@ if (GETPOST('refreshpage')) $action='preview';
// Add a collab page
if ($action == 'add')
{
$db->begin();
$db->begin();
$objectpage->title = GETPOST('WEBSITE_TITLE');
$objectpage->pageurl = GETPOST('WEBSITE_PAGENAME');
$objectpage->description = GETPOST('WEBSITE_DESCRIPTION');
$objectpage->keywords = GETPOST('WEBSITE_KEYWORD');
$objectpage->title = GETPOST('WEBSITE_TITLE');
$objectpage->pageurl = GETPOST('WEBSITE_PAGENAME');
$objectpage->description = GETPOST('WEBSITE_DESCRIPTION');
$objectpage->keywords = GETPOST('WEBSITE_KEYWORD');
if (empty($objectpage->title))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("WEBSITE_PAGENAME")), null, 'errors');
$error++;
}
if (empty($objectpage->title))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("WEBSITE_PAGENAME")), null, 'errors');
$error++;
}
if (! $error)
{
$res = $objectpage->create($user);
if ($res <= 0)
{
$error++;
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
}
}
if (! $error)
{
$res = $objectpage->create($user);
if ($res <= 0)
{
$error++;
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
}
}
if (! $error)
{
$db->commit();
setEventMessages($langs->trans("PageAdded", $objectpage->pageurl), null, 'mesgs');
$action='';
setEventMessages($langs->trans("PageAdded", $objectpage->pageurl), null, 'mesgs');
$action='';
}
else
{
@ -111,38 +111,38 @@ if ($action == 'add')
// Update page
if ($action == 'delete')
{
$db->begin();
$db->begin();
$res = $object->fetch(0, $website);
$res = $object->fetch(0, $website);
$res = $objectpage->fetch($pageid, $object->fk_website);
$res = $objectpage->fetch($pageid, $object->fk_website);
if ($res > 0)
{
$res = $objectpage->delete($user);
if (! $res > 0)
{
$error++;
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
}
if ($res > 0)
{
$res = $objectpage->delete($user);
if (! $res > 0)
{
$error++;
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
}
if (! $error)
{
$db->commit();
setEventMessages($langs->trans("PageDeleted", $objectpage->pageurl, $website), null, 'mesgs');
if (! $error)
{
$db->commit();
setEventMessages($langs->trans("PageDeleted", $objectpage->pageurl, $website), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website);
exit;
}
else
{
$db->rollback();
}
}
else
{
dol_print_error($db);
}
header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website);
exit;
}
else
{
$db->rollback();
}
}
else
{
dol_print_error($db);
}
}
@ -161,7 +161,7 @@ print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST"><div>';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
if ($action == 'create')
{
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="action" value="add">';
}
@ -174,225 +174,225 @@ print '<div class="centpercent websitebar">';
if (count($object->records) > 0)
{
// ***** Part for web sites
// ***** Part for web sites
print '<div class="websiteselection hideonsmartphoneimp">';
print $langs->trans("Website").': ';
print '</div>';
print '<div class="websiteselection hideonsmartphoneimp">';
print $langs->trans("Website").': ';
print '</div>';
// List of websites
print '<div class="websiteselection">';
$out='';
$out.='<select name="website" class="minwidth100" id="website">';
if (empty($object->records)) $out.='<option value="-1">&nbsp;</option>';
// Loop on each sites
$i=0;
foreach($object->records as $key => $valwebsite)
{
if (empty($website)) $website=$valwebsite->ref;
// List of websites
print '<div class="websiteselection">';
$out='';
$out.='<select name="website" class="minwidth100" id="website">';
if (empty($object->records)) $out.='<option value="-1">&nbsp;</option>';
// Loop on each sites
$i=0;
foreach($object->records as $key => $valwebsite)
{
if (empty($website)) $website=$valwebsite->ref;
$out.='<option value="'.$valwebsite->ref.'"';
if ($website == $valwebsite->ref) $out.=' selected'; // To preselect a value
$out.='>';
$out.=$valwebsite->ref;
$out.='</option>';
$i++;
}
$out.='</select>';
$out.=ajax_combobox('website');
print $out;
print '<input type="submit" class="button" name="refreshsite" value="'.$langs->trans("Load").'">';
$out.='<option value="'.$valwebsite->ref.'"';
if ($website == $valwebsite->ref) $out.=' selected'; // To preselect a value
$out.='>';
$out.=$valwebsite->ref;
$out.='</option>';
$i++;
}
$out.='</select>';
$out.=ajax_combobox('website');
print $out;
print '<input type="submit" class="button" name="refreshsite" value="'.$langs->trans("Load").'">';
if ($website)
{
$virtualurl='';
$dataroot=DOL_DATA_ROOT.'/websites/'.$website;
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
}
if ($website)
{
$virtualurl='';
$dataroot=DOL_DATA_ROOT.'/websites/'.$website;
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
}
if ($website && $action == 'preview')
{
$disabled='';
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
if ($website && $action == 'preview')
{
$disabled='';
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
print ' &nbsp; ';
print ' &nbsp; ';
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="editmedia">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
print '<input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("AddPage")).'" name="create">';
}
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="editmedia">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
print '<input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("AddPage")).'" name="create">';
}
print '</div>';
print '</div>';
// Button for websites
print '<div class="websitetools">';
// Button for websites
print '<div class="websitetools">';
if ($action == 'preview')
{
print '<div class="websiteinputurl">';
print '<input type="text" id="previewsiteurl" class="minwidth200imp" name="previewsite" placeholder="'.$langs->trans("http://myvirtualhost").'" value="'.$virtualurl.'">';
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
$htmltext=$langs->trans("SetHereVirtualHost", $dataroot);
print $form->textwithpicto('', $htmltext);
print '</div>';
if ($action == 'preview')
{
print '<div class="websiteinputurl">';
print '<input type="text" id="previewsiteurl" class="minwidth200imp" name="previewsite" placeholder="'.$langs->trans("http://myvirtualhost").'" value="'.$virtualurl.'">';
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
$htmltext=$langs->trans("SetHereVirtualHost", $dataroot);
print $form->textwithpicto('', $htmltext);
print '</div>';
$urlext=$virtualurl;
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
//if (! empty($object->virtualhost))
//{
print '<a class="websitebuttonsitepreview" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
print '</a>';
//}
$urlext=$virtualurl;
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
//if (! empty($object->virtualhost))
//{
print '<a class="websitebuttonsitepreview" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
print '</a>';
//}
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
print '</a>';
}
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
print '</a>';
}
if (in_array($action, array('editcss','editmenu','create')))
{
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
}
if (in_array($action, array('editcss','editmenu','create')))
{
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
}
print '</div>';
print '</div>';
// ***** Part for pages
// ***** Part for pages
if ($website)
{
print '</div>';
if ($website)
{
print '</div>';
$array=$objectpage->fetchAll($object->id);
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage=(is_array($array) && count($array) > 0);
$array=$objectpage->fetchAll($object->id);
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage=(is_array($array) && count($array) > 0);
print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">';
print '<div class="websiteselection hideonsmartphoneimp">';
print $langs->trans("Page").': ';
print '</div>';
print '<div class="websiteselection">';
print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">';
print '<div class="websiteselection hideonsmartphoneimp">';
print $langs->trans("Page").': ';
print '</div>';
print '<div class="websiteselection">';
if ($action != 'add')
{
$out='';
$out.='<select name="pageid" id="pageid" class="minwidth200">';
if ($atleastonepage)
{
if (empty($pageid) && $action != 'create') // Page id is not defined, we try to take one
{
$firstpageid=0;$homepageid=0;
foreach($array as $key => $valpage)
{
if (empty($firstpageid)) $firstpageid=$valpage->id;
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id;
}
$pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page
}
if ($action != 'add')
{
$out='';
$out.='<select name="pageid" id="pageid" class="minwidth200">';
if ($atleastonepage)
{
if (empty($pageid) && $action != 'create') // Page id is not defined, we try to take one
{
$firstpageid=0;$homepageid=0;
foreach($array as $key => $valpage)
{
if (empty($firstpageid)) $firstpageid=$valpage->id;
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id;
}
$pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page
}
foreach($array as $key => $valpage)
{
$out.='<option value="'.$key.'"';
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
$out.='>';
$out.=$valpage->title;
if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
$out.='</option>';
}
}
else $out.='<option value="-1">&nbsp;</option>';
$out.='</select>';
$out.=ajax_combobox('pageid');
print $out;
}
else
{
print $langs->trans("New");
}
foreach($array as $key => $valpage)
{
$out.='<option value="'.$key.'"';
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
$out.='>';
$out.=$valpage->title;
if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
$out.='</option>';
}
}
else $out.='<option value="-1">&nbsp;</option>';
$out.='</select>';
$out.=ajax_combobox('pageid');
print $out;
}
else
{
print $langs->trans("New");
}
print '<input type="submit" class="button" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
//print $form->selectarray('page', $array);
print '<input type="submit" class="button" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
//print $form->selectarray('page', $array);
if ($action == 'preview')
{
$disabled='';
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
if ($action == 'preview')
{
$disabled='';
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
if ($pageid > 0)
{
print ' &nbsp; ';
if ($pageid > 0)
{
print ' &nbsp; ';
if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print '<input type="submit" class="button" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
else print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageContent")).'" name="editcontent">';
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editmeta&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageMeta")).'</a>';
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editcontent&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageContent")).'</a>';
print '<input type="submit" class="buttonDelete" name="delete" value="'.$langs->trans("Delete").'"'.($atleastonepage?'':' disabled="disabled"').'>';
}
}
if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print '<input type="submit" class="button" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
else print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageContent")).'" name="editcontent">';
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editmeta&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageMeta")).'</a>';
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editcontent&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageContent")).'</a>';
print '<input type="submit" class="buttonDelete" name="delete" value="'.$langs->trans("Delete").'"'.($atleastonepage?'':' disabled="disabled"').'>';
}
}
print '</div>';
print '<div class="websiteselection">';
print '</div>';
print '</div>';
print '<div class="websiteselection">';
print '</div>';
print '<div class="websitetools">';
print '<div class="websitetools">';
if ($website && $pageid > 0 && $action == 'preview')
{
$websitepage = new WebSitePage($db);
$websitepage->fetch($pageid);
if ($website && $pageid > 0 && $action == 'preview')
{
$websitepage = new WebSitePage($db);
$websitepage->fetch($pageid);
$realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid;
$pagealias = $websitepage->pageurl;
$realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid;
$pagealias = $websitepage->pageurl;
print '<div class="websiteinputurl">';
print '<input type="text" id="previewpageurl" class="minwidth200imp" name="previewsite" value="'.$pagealias.'" disabled="disabled">';
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
$htmltext=$langs->trans("WEBSITE_PAGENAME", $pagealias);
print $form->textwithpicto('', $htmltext);
print '</div>';
print '<div class="websiteinputurl">';
print '<input type="text" id="previewpageurl" class="minwidth200imp" name="previewsite" value="'.$pagealias.'" disabled="disabled">';
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
$htmltext=$langs->trans("WEBSITE_PAGENAME", $pagealias);
print $form->textwithpicto('', $htmltext);
print '</div>';
if (! empty($object->virtualhost))
{
$urlext=$virtualurl.'/'.$pagealias.'.php';
print '<a class="websitebuttonsitepreview" id="previewpageext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
print '</a>';
}
else
{
print '<a class="websitebuttonsitepreview" id="previewpageextnoclick" href="#">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
print '</a>';
}
if (! empty($object->virtualhost))
{
$urlext=$virtualurl.'/'.$pagealias.'.php';
print '<a class="websitebuttonsitepreview" id="previewpageext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
print '</a>';
}
else
{
print '<a class="websitebuttonsitepreview" id="previewpageextnoclick" href="#">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
print '</a>';
}
print '<a class="websitebuttonsitepreview" id="previewpage" href="'.$realpage.'&nocache='.dol_now().'" class="button" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview');
print '</a>'; // View page in new Tab
//print '<input type="submit" class="button" name="previewpage" target="tab'.$website.'"value="'.$langs->trans("ViewPageInNewTab").'">';
print '<a class="websitebuttonsitepreview" id="previewpage" href="'.$realpage.'&nocache='.dol_now().'" class="button" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview');
print '</a>'; // View page in new Tab
//print '<input type="submit" class="button" name="previewpage" target="tab'.$website.'"value="'.$langs->trans("ViewPageInNewTab").'">';
// TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext
}
if (! in_array($action, array('editcss','editmenu','create')))
{
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
}
// TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext
}
if (! in_array($action, array('editcss','editmenu','create')))
{
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
}
print '</div>';
print '</div>';
if ($action == 'preview')
{
// Adding jquery code to change on the fly url of preview ext
if (! empty($conf->use_javascript_ajax))
{
print '<script type="text/javascript" language="javascript">
if ($action == 'preview')
{
// Adding jquery code to change on the fly url of preview ext
if (! empty($conf->use_javascript_ajax))
{
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#previewsiteext,#previewpageext").click(function() {
newurl=jQuery("#previewsiteurl").val();
@ -417,17 +417,17 @@ if (count($object->records) > 0)
});
});
</script>';
}
}
}
}
}
}
}
else
{
print '<div class="websiteselection">';
$langs->load("errors");
print $langs->trans("ErrorModuleSetupNotComplete");
print '<div>';
$action='';
print '<div class="websiteselection">';
$langs->load("errors");
print $langs->trans("ErrorModuleSetupNotComplete");
print '<div>';
$action='';
}
@ -437,21 +437,21 @@ $head = array();
if ($action == 'editcontent')
{
/*
/*
* Editing global variables not related to a specific theme
*/
$csscontent = @file_get_contents($filecss);
$csscontent = @file_get_contents($filecss);
$contentforedit = '';
/*$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
$contentforedit = '';
/*$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
$contentforedit.=$csscontent;
$contentforedit.='</style>'."\n";*/
$contentforedit .= $objectpage->content;
$contentforedit .= $objectpage->content;
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,true,ROWS_5,'90%');
$doleditor->Create(0, '', false);
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,true,ROWS_5,'90%');
$doleditor->Create(0, '', false);
}
print "</div>\n</form>\n";

View File

@ -170,7 +170,7 @@ if (empty($reshook))
$result = $object->set_reopen($user);
if ($result > 0)
{
setEventMessages($langs->trans('OrderReopened', $object->ref), null);
setEventMessages($langs->trans('OrderReopened', $object->ref), null);
}
else
{
@ -264,12 +264,12 @@ if (empty($reshook))
$object->modelpdf = GETPOST('model');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
$object->fk_account = GETPOST('fk_account', 'int');
$object->availability_id = GETPOST('availability_id');
$object->demand_reason_id = GETPOST('demand_reason_id');
$object->date_livraison = $datelivraison;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->warehouse_id = GETPOST('warehouse_id', 'int');
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->warehouse_id = GETPOST('warehouse_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address');
$object->contactid = GETPOST('contactid');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
@ -279,8 +279,8 @@ if (empty($reshook))
// Fill array 'array_options' with data from add form
if (! $error)
{
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) $error++;
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) $error++;
}
// If creation from another object of another module (Example: origin=propal, originid=1)
@ -366,7 +366,7 @@ if (empty($reshook))
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
// trigger used
// trigger used
{
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_options = $lines[$i]->array_options;
@ -423,7 +423,7 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if ($reshook < 0)
$error++;
$error++;
} else {
setEventMessages($object->error, $object->errors, 'errors');
@ -491,10 +491,10 @@ if (empty($reshook))
}
else if ($action == 'classifyunbilled' && $user->rights->commande->creer)
{
$ret=$object->classifyUnBilled();
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
$ret=$object->classifyUnBilled();
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Positionne ref commande client
@ -502,7 +502,7 @@ if (empty($reshook))
$result = $object->set_ref_client($user, GETPOST('ref_client'));
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -510,7 +510,7 @@ if (empty($reshook))
$result = $object->set_remise($user, GETPOST('remise'));
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -563,7 +563,7 @@ if (empty($reshook))
else if ($action == 'setavailability' && $user->rights->commande->creer) {
$result = $object->availability(GETPOST('availability_id'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
else if ($action == 'setdemandreason' && $user->rights->commande->creer) {
@ -596,36 +596,36 @@ if (empty($reshook))
// Set incoterm
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
{
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
{
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// bank account
else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// shipping method
else if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// warehouse
else if ($action == 'setwarehouse' && $user->rights->commande->creer) {
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// warehouse
else if ($action == 'setwarehouse' && $user->rights->commande->creer) {
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
else if ($action == 'setremisepercent' && $user->rights->commande->creer) {
$result = $object->set_remise($user, GETPOST('remise_percent'));
@ -898,18 +898,18 @@ if (empty($reshook))
unset($_POST['idprod']);
unset($_POST['units']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
@ -1062,13 +1062,13 @@ if (empty($reshook))
}
else if ($action == 'confirm_validate' && $confirm == 'yes' &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
)
{
$idwarehouse = GETPOST('idwarehouse');
$qualified_for_stock_change=0;
$qualified_for_stock_change=0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$qualified_for_stock_change=$object->hasProductsOrServices(2);
@ -1121,7 +1121,7 @@ if (empty($reshook))
else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
$idwarehouse = GETPOST('idwarehouse');
$qualified_for_stock_change=0;
$qualified_for_stock_change=0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$qualified_for_stock_change=$object->hasProductsOrServices(2);
@ -1174,13 +1174,13 @@ if (empty($reshook))
}
else if ($action == 'confirm_cancel' && $confirm == 'yes' &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
)
{
$idwarehouse = GETPOST('idwarehouse');
$qualified_for_stock_change=0;
$qualified_for_stock_change=0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$qualified_for_stock_change=$object->hasProductsOrServices(2);
@ -1223,7 +1223,7 @@ if (empty($reshook))
$hookmanager->initHooks(array('orderdao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
if ($result < 0) {
@ -1393,10 +1393,10 @@ if ($action == 'create' && $user->rights->commande->creer)
$soc = $objectsrc->thirdparty;
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
$availability_id = (!empty($objectsrc->availability_id)?$objectsrc->availability_id:(!empty($soc->availability_id)?$soc->availability_id:0));
$shipping_method_id = (! empty($objectsrc->shipping_method_id)?$objectsrc->shipping_method_id:(! empty($soc->shipping_method_id)?$soc->shipping_method_id:0));
$warehouse_id = (! empty($objectsrc->warehouse_id)?$objectsrc->warehouse_id:(! empty($soc->warehouse_id)?$soc->warehouse_id:0));
$shipping_method_id = (! empty($objectsrc->shipping_method_id)?$objectsrc->shipping_method_id:(! empty($soc->shipping_method_id)?$soc->shipping_method_id:0));
$warehouse_id = (! empty($objectsrc->warehouse_id)?$objectsrc->warehouse_id:(! empty($soc->warehouse_id)?$soc->warehouse_id:0));
$demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0));
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
@ -1421,10 +1421,10 @@ if ($action == 'create' && $user->rights->commande->creer)
{
$cond_reglement_id = $soc->cond_reglement_id;
$mode_reglement_id = $soc->mode_reglement_id;
$fk_account = $soc->fk_account;
$fk_account = $soc->fk_account;
$availability_id = $soc->availability_id;
$shipping_method_id = $soc->shipping_method_id;
$warehouse_id = $soc->warehouse_id;
$shipping_method_id = $soc->shipping_method_id;
$warehouse_id = $soc->warehouse_id;
$demand_reason_id = $soc->demand_reason_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
@ -1537,12 +1537,12 @@ if ($action == 'create' && $user->rights->commande->creer)
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id');
print '</td></tr>';
// Bank Account
// Bank Account
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled))
{
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td>';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
}
// Delivery delay
@ -1550,21 +1550,21 @@ if ($action == 'create' && $user->rights->commande->creer)
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1);
print '</td></tr>';
// Shipping Method
if (! empty($conf->expedition->enabled)) {
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td>';
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
print '</td></tr>';
}
// Shipping Method
if (! empty($conf->expedition->enabled)) {
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td>';
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
print '</td></tr>';
}
// Warehouse
if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct=new FormProduct($db);
print '<tr><td>' . $langs->trans('Warehouse') . '</td><td>';
print $formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1);
print '</td></tr>';
}
// Warehouse
if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct=new FormProduct($db);
print '<tr><td>' . $langs->trans('Warehouse') . '</td><td>';
print $formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1);
print '</td></tr>';
}
// What trigger creation
print '<tr><td>' . $langs->trans('Source') . '</td><td>';
@ -1590,22 +1590,22 @@ if ($action == 'create' && $user->rights->commande->creer)
{
print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->libelle_incoterms, 1).'</label></td>';
print '<td class="maxwidthonsmartphone">';
$incoterm_id = GETPOST('incoterm_id');
$incoterm_location = GETPOST('location_incoterms');
if (empty($incoterm_id))
{
$incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms);
$incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms);
}
print $form->select_incoterms($incoterm_id, $incoterm_location);
print '<td class="maxwidthonsmartphone">';
$incoterm_id = GETPOST('incoterm_id');
$incoterm_location = GETPOST('location_incoterms');
if (empty($incoterm_id))
{
$incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms);
$incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms);
}
print $form->select_incoterms($incoterm_id, $incoterm_location);
print '</td></tr>';
}
// Other attributes
$parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
print $hookmanager->resPrint;
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $object->showOptionals($extrafields, 'edit');
}
@ -1623,8 +1623,8 @@ if ($action == 'create' && $user->rights->commande->creer)
{
print '<tr>';
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
print '<td class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '<td class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '</td></tr>';
}
@ -1918,69 +1918,69 @@ if ($action == 'create' && $user->rights->commande->creer)
// Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherOrders").'</a>)';
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->commande->creer)
{
if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} 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);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->commande->creer)
{
if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} 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);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border" width="100%">';
if ($soc->outstanding_limit)
{
// Outstanding Bill
print '<tr><td class="titlefield">';
print $langs->trans('OutstandingBill');
print '</td><td>';
print price($soc->get_OutstandingBill()) . ' / ';
print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency);
print '</td>';
print '</tr>';
// Outstanding Bill
print '<tr><td class="titlefield">';
print $langs->trans('OutstandingBill');
print '</td><td>';
print price($soc->get_OutstandingBill()) . ' / ';
print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency);
print '</td>';
print '</tr>';
}
// Relative and absolute discounts
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final
// invoice
// invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')";
@ -2037,7 +2037,7 @@ if ($action == 'create' && $user->rights->commande->creer)
} else {
print $object->date ? dol_print_date($object->date, 'day') : '&nbsp;';
if ($object->hasDelay() && ! empty($object->date_livraison)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
}
print '</td>';
@ -2062,51 +2062,51 @@ if ($action == 'create' && $user->rights->commande->creer)
} else {
print $object->date_livraison ? dol_print_date($object->date_livraison, 'daytext') : '&nbsp;';
if ($object->hasDelay() && ! empty($object->date_livraison)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
}
print '</td>';
print '</tr>';
// Shipping Method
if (! empty($conf->expedition->enabled)) {
print '<tr><td height="10">';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('SendingMethod');
print '</td>';
if ($action != 'editshippingmethod' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&amp;id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editshippingmethod') {
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
} else {
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
}
print '</td>';
print '</tr>';
}
// Shipping Method
if (! empty($conf->expedition->enabled)) {
print '<tr><td height="10">';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('SendingMethod');
print '</td>';
if ($action != 'editshippingmethod' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&amp;id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editshippingmethod') {
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
} else {
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
}
print '</td>';
print '</tr>';
}
// Warehouse
if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct=new FormProduct($db);
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('Warehouse');
print '</td>';
if ($action != 'editwarehouse' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&amp;id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'),1).'</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editwarehouse') {
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
} else {
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none');
}
print '</td>';
print '</tr>';
}
// Warehouse
if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct=new FormProduct($db);
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('Warehouse');
print '</td>';
if ($action != 'editwarehouse' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&amp;id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'),1).'</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editwarehouse') {
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
} else {
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none');
}
print '</td>';
print '</tr>';
}
// Terms of payment
print '<tr><td>';
@ -2173,9 +2173,9 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</tr></table>';
print '</td><td>';
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
if($action == 'actualizemulticurrencyrate') {
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
}
if($action == 'actualizemulticurrencyrate') {
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
}
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
} else {
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
@ -2243,30 +2243,30 @@ if ($action == 'create' && $user->rights->commande->creer)
$totalVolume=$tmparray['volume'];
if ($totalWeight || $totalVolume)
{
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
print '<td>';
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
print '</td></tr>';
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
print '<td>';
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
print '</td></tr>';
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
print '<td>';
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
print '</td></tr>';
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
print '<td>';
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
print '</td></tr>';
}
// TODO How record was recorded OrderMode (llx_c_input_method)
// TODO How record was recorded OrderMode (llx_c_input_method)
// Incoterms
if (!empty($conf->incoterm->enabled))
{
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
print '<td><td align="right">';
if ($user->rights->commande->creer) print '<a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
else print '&nbsp;';
print '</td></tr></table>';
print '</td>';
print '<td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
print '<td><td align="right">';
if ($user->rights->commande->creer) print '<a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
else print '&nbsp;';
print '</td></tr></table>';
print '</td>';
print '<td>';
if ($action != 'editincoterm')
{
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
@ -2275,27 +2275,27 @@ if ($action == 'create' && $user->rights->commande->creer)
{
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
}
print '</td></tr>';
print '</td></tr>';
}
// Bank Account
// Bank Account
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled))
{
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
print '<td>';
if ($action != 'editbankaccount' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
} else {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
}
print '</td>';
print '</tr>';
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
print '<td>';
if ($action != 'editbankaccount' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
} else {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
}
print '</td>';
print '</tr>';
}
// Other attributes
@ -2312,20 +2312,20 @@ if ($action == 'create' && $user->rights->commande->creer)
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
{
// Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>';
// Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>';
// Multicurrency Amount VAT
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>';
// Multicurrency Amount VAT
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>';
// Multicurrency Amount TTC
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>';
// Multicurrency Amount TTC
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>';
}
// Total HT
@ -2357,7 +2357,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Margin Infos
if (! empty($conf->margin->enabled)) {
$formmargin->displayMarginInfos($object);
$formmargin->displayMarginInfos($object);
}
@ -2395,7 +2395,7 @@ if ($action == 'create' && $user->rights->commande->creer)
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
print '<div class="div-table-responsive-no-min">';
print '<div class="div-table-responsive-no-min">';
print '<table id="tablelines" class="noborder noshadow" width="100%">';
// Show object lines
@ -2421,7 +2421,7 @@ if ($action == 'create' && $user->rights->commande->creer)
}
}
print '</table>';
print '</div>';
print '</div>';
print "</form>\n";
@ -2435,7 +2435,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
// modified by hook
if (empty($reshook)) {
// Send
if ($object->statut > Commande::STATUS_DRAFT) {
@ -2445,10 +2445,10 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('SendByMail') . '</a></div>';
}
// Valid
// Valid
if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
)
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>';
@ -2459,8 +2459,8 @@ if ($action == 'create' && $user->rights->commande->creer)
}
// Create event
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a
// "workflow" action so should appears somewhere else on
// page.
// "workflow" action so should appears somewhere else on
// page.
{
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
}
@ -2480,11 +2480,11 @@ if ($action == 'create' && $user->rights->commande->creer)
// Create contract
if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)) {
$langs->load("contracts");
$langs->load("contracts");
if ($user->rights->contrat->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a></div>';
}
if ($user->rights->contrat->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a></div>';
}
}
// Ship
@ -2527,9 +2527,9 @@ if ($action == 'create' && $user->rights->commande->creer)
}
}
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifyunbilled">' . $langs->trans("ClassifyUnBilled") . '</a></div>';
}
if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifyunbilled">' . $langs->trans("ClassifyUnBilled") . '</a></div>';
}
}
// Clone
if ($user->rights->commande->creer) {
@ -2538,8 +2538,8 @@ if ($action == 'create' && $user->rights->commande->creer)
// Cancel order
if ($object->statut == Commande::STATUS_VALIDATED &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->cloturer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)))
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->cloturer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)))
)
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=cancel">' . $langs->trans('Cancel') . '</a></div>';

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -267,22 +267,22 @@ class EmailSenderProfile extends CommonObject
function getNomUrl($withpicto=0)
{
global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
$result = '';
$companylink = '';
$result = '';
$companylink = '';
$url='';
//$url = dol_buildpath('/monmodule/emailsenderprofile_card.php',1).'?id='.$this->id;
$url='';
//$url = dol_buildpath('/monmodule/emailsenderprofile_card.php',1).'?id='.$this->id;
$linkstart = '';
$linkend='';
if ($withpicto)
{
$result.=($linkstart.img_object($label, 'label', 'class="classfortooltip"').$linkend);
if ($withpicto != 2) $result.=' ';
if ($withpicto)
{
$result.=($linkstart.img_object($label, 'label', 'class="classfortooltip"').$linkend);
if ($withpicto != 2) $result.=' ';
}
$result.= $linkstart . $this->label . $linkend;
return $result;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -96,15 +96,15 @@ class ExpenseReportRule extends CoreObject
/**
* Attribute object linked with database
* @var array
*/
/**
* Attribute object linked with database
* @var array
*/
protected $fields=array(
'rowid'=>array('type'=>'integer','index'=>true)
,'dates'=>array('type'=>'date')
,'datee'=>array('type'=>'date')
,'amount'=>array('type'=>'double')
,'amount'=>array('type'=>'double')
,'restrictive'=>array('type'=>'integer')
,'fk_user'=>array('type'=>'integer')
,'fk_usergroup'=>array('type'=>'integer')
@ -114,16 +114,16 @@ class ExpenseReportRule extends CoreObject
,'entity'=>array('type'=>'integer')
);
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB &$db)
{
global $conf;
parent::__construct($db);
parent::__construct($db);
parent::init();
$this->errors = array();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -540,164 +540,164 @@ if ($socid && $action != 'edit' && $action != "create")
print ' '.img_picto($langs->trans("SwiftValid"),'info');
}
}
print '</td>';
print '</td>';
if (! empty($conf->prelevement->enabled))
{
// RUM
if (! empty($conf->prelevement->enabled))
{
// RUM
//print '<td>'.$prelevement->buildRumNumber($object->code_client, $rib->datec, $rib->id).'</td>';
print '<td>'.$rib->rum.'</td>';
print '<td>'.$rib->rum.'</td>';
// FRSTRECUR
print '<td>'.$rib->frstrecur.'</td>';
}
}
// Default
print '<td align="center" width="70">';
if (!$rib->default_rib) {
print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id.'&ribid='.$rib->id.'&action=setasdefault">';
print img_picto($langs->trans("Disabled"),'off');
print '</a>';
} else {
print img_picto($langs->trans("Enabled"),'on');
}
print '</td>';
// Default
print '<td align="center" width="70">';
if (!$rib->default_rib) {
print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id.'&ribid='.$rib->id.'&action=setasdefault">';
print img_picto($langs->trans("Disabled"),'off');
print '</a>';
} else {
print img_picto($langs->trans("Enabled"),'on');
}
print '</td>';
// Generate doc
print '<td align="center">';
// Generate doc
print '<td align="center">';
$buttonlabel = $langs->trans("BuildDoc");
$forname='builddocrib'.$rib->id;
$buttonlabel = $langs->trans("BuildDoc");
$forname='builddocrib'.$rib->id;
include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php';
$modellist=ModeleBankAccountDoc::liste_modeles($db);
include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php';
$modellist=ModeleBankAccountDoc::liste_modeles($db);
$out = '';
if (is_array($modellist) && count($modellist))
{
$out.= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">';
$out.= '<input type="hidden" name="action" value="builddocrib">';
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out.= '<input type="hidden" name="socid" value="'.$object->id.'">';
$out.= '<input type="hidden" name="companybankid" value="'.$rib->id.'">';
$out = '';
if (is_array($modellist) && count($modellist))
{
$out.= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">';
$out.= '<input type="hidden" name="action" value="builddocrib">';
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out.= '<input type="hidden" name="socid" value="'.$object->id.'">';
$out.= '<input type="hidden" name="companybankid" value="'.$rib->id.'">';
if (is_array($modellist) && count($modellist) == 1) // If there is only one element
{
$arraykeys=array_keys($modellist);
$modelselected=$arraykeys[0];
}
if (! empty($conf->global->BANKADDON_PDF)) $modelselected = $conf->global->BANKADDON_PDF;
if (is_array($modellist) && count($modellist) == 1) // If there is only one element
{
$arraykeys=array_keys($modellist);
$modelselected=$arraykeys[0];
}
if (! empty($conf->global->BANKADDON_PDF)) $modelselected = $conf->global->BANKADDON_PDF;
$out.= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100');
$out.= ajax_combobox('modelrib'.$rib->id);
$out.= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100');
$out.= ajax_combobox('modelrib'.$rib->id);
// Language code (if multilang)
if ($conf->global->MAIN_MULTILANGS)
{
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin=new FormAdmin($db);
$defaultlang=$codelang?$codelang:$langs->getDefaultLang();
$morecss='maxwidth150';
if (! empty($conf->browser->phone)) $morecss='maxwidth100';
$out.= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss);
}
// Button
$genbutton = '<input class="button buttongen" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton.= ' type="submit" value="'.$buttonlabel.'"';
if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) $genbutton.= ' disabled';
$genbutton.= '>';
if ($allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid')
{
$langs->load("errors");
$genbutton.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated"));
}
if (! $allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') $genbutton='';
if (empty($modellist) && ! $showempty && $modulepart != 'unpaid') $genbutton='';
$out.= $genbutton;
$out.= '</form>';
}
print $out;
print '</td>';
// Language code (if multilang)
if ($conf->global->MAIN_MULTILANGS)
{
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin=new FormAdmin($db);
$defaultlang=$codelang?$codelang:$langs->getDefaultLang();
$morecss='maxwidth150';
if (! empty($conf->browser->phone)) $morecss='maxwidth100';
$out.= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss);
}
// Button
$genbutton = '<input class="button buttongen" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton.= ' type="submit" value="'.$buttonlabel.'"';
if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) $genbutton.= ' disabled';
$genbutton.= '>';
if ($allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid')
{
$langs->load("errors");
$genbutton.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated"));
}
if (! $allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') $genbutton='';
if (empty($modellist) && ! $showempty && $modulepart != 'unpaid') $genbutton='';
$out.= $genbutton;
$out.= '</form>';
}
print $out;
print '</td>';
// Edit/Delete
print '<td align="right">';
if ($user->rights->societe->creer)
{
print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id.'&id='.$rib->id.'&action=edit">';
print img_picto($langs->trans("Modify"),'edit');
print '</a>';
// Edit/Delete
print '<td align="right">';
if ($user->rights->societe->creer)
{
print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id.'&id='.$rib->id.'&action=edit">';
print img_picto($langs->trans("Modify"),'edit');
print '</a>';
print '&nbsp;';
print '&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id.'&id='.$rib->id.'&action=delete">';
print img_picto($langs->trans("Delete"),'delete');
print '</a>';
}
print '</td>';
print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id.'&id='.$rib->id.'&action=delete">';
print img_picto($langs->trans("Delete"),'delete');
print '</a>';
}
print '</td>';
print '</tr>';
}
print '</tr>';
}
if (count($rib_list) == 0)
{
$colspan=8;
if (! empty($conf->prelevement->enabled)) $colspan+=2;
print '<tr '.$bc[0].'><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoBANRecord").'</td></tr>';
}
if (count($rib_list) == 0)
{
$colspan=8;
if (! empty($conf->prelevement->enabled)) $colspan+=2;
print '<tr '.$bc[0].'><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoBANRecord").'</td></tr>';
}
print '</table>';
print '</div>';
} else {
dol_print_error($db);
}
print '</table>';
print '</div>';
} else {
dol_print_error($db);
}
dol_fiche_end();
dol_fiche_end();
if ($socid && $action != 'edit' && $action != 'create')
{
/*
if ($socid && $action != 'edit' && $action != 'create')
{
/*
* Barre d'actions
*/
print '<div class="tabsAction">';
print '<div class="tabsAction">';
if ($user->rights->societe->creer)
{
print '<a class="butAction" href="rib.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("Add").'</a>';
}
if ($user->rights->societe->creer)
{
print '<a class="butAction" href="rib.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("Add").'</a>';
}
print '</div>';
}
print '</div>';
}
if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC))
{
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC))
{
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
/*
/*
* Documents generes
*/
$filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id;
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id;
$genallowed=$user->rights->societe->creer;
$delallowed=$user->rights->societe->supprimer;
$filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id;
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id;
$genallowed=$user->rights->societe->creer;
$delallowed=$user->rights->societe->supprimer;
$var=true;
$var=true;
print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang);
print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div></div></div>';
print '</div></div></div>';
print '<br>';
}
/*
print '<br>';
}
/*
include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php';
$modellist=ModeleBankAccountDoc::liste_modeles($db);
//print '<td>';

View File

@ -194,8 +194,8 @@ if (empty($reshook))
// Validation
else if ($action == 'confirm_validate' && $confirm == 'yes' &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->supplier_proposal->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->supplier_proposal->validate_advance)))
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->supplier_proposal->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->supplier_proposal->validate_advance)))
)
{
$result = $object->valid($user);
@ -258,7 +258,7 @@ if (empty($reshook))
if ($object->fetch(GETPOST('copie_supplier_proposal')) > 0) {
$object->ref = GETPOST('ref');
$object->date_livraison = $date_delivery;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
@ -279,7 +279,7 @@ if (empty($reshook))
$object->ref = GETPOST('ref');
$object->date_livraison = $date_delivery;
$object->demand_reason_id = GETPOST('demand_reason_id');
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
@ -381,7 +381,7 @@ if (empty($reshook))
// Hooks
$parameters = array('objFrom' => $srcobject);
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
// modified by hook
if ($reshook < 0)
$error ++;
} else {
@ -404,23 +404,23 @@ if (empty($reshook))
{
$db->commit();
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model=$object->modelpdf;
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) dol_print_error($db,$result);
}
$ret = $object->fetch($id); // Reload to get new records
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) dol_print_error($db,$result);
}
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
exit();
@ -451,8 +451,8 @@ if (empty($reshook))
// Close proposal
else if ($action == 'close' && $user->rights->supplier_proposal->cloturer && ! GETPOST('cancel','alpha')) {
// prevent browser refresh from reopening proposal several times
if ($object->statut == SupplierProposal::STATUS_SIGNED) {
// prevent browser refresh from reopening proposal several times
if ($object->statut == SupplierProposal::STATUS_SIGNED) {
$object->setStatut(SupplierProposal::STATUS_CLOSE);
}
}
@ -465,7 +465,7 @@ if (empty($reshook))
} else {
// prevent browser refresh from closing proposal several times
if ($object->statut == SupplierProposal::STATUS_VALIDATED) {
$object->cloture($user, GETPOST('statut'), GETPOST('note','none'));
$object->cloture($user, GETPOST('statut'), GETPOST('note','none'));
}
}
}
@ -518,12 +518,12 @@ if (empty($reshook))
// Add a product line
if ($action == 'addline' && $user->rights->supplier_proposal->creer)
{
$langs->load('errors');
$error = 0;
$langs->load('errors');
$error = 0;
// Set if we used free entry or predefined product
$predef='';
$ref_fourn = GETPOST('fourn_ref');
$predef='';
$ref_fourn = GETPOST('fourn_ref');
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
@ -583,117 +583,117 @@ if (empty($reshook))
// Ecrase $txtva par celui du produit
if ((GETPOST('prod_entry_mode') != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
{
$productsupplier = new ProductFournisseur($db);
$productsupplier = new ProductFournisseur($db);
if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED)) // TODO this test seems useless
{
$idprod=0;
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
}
if (preg_match('/^idprod_([0-9]+)$/',GETPOST('idprodfournprice'), $reg))
{
$idprod=$reg[1];
$res=$productsupplier->fetch($idprod);
// Call to init properties of $productsupplier
// So if a supplier price already exists for another thirdparty (first one found), we use it as reference price
$productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist
}
elseif (GETPOST('idprodfournprice') > 0)
{
//$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat.
$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch);
$res=$productsupplier->fetch($idprod);
}
if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED)) // TODO this test seems useless
{
$idprod=0;
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
}
if (preg_match('/^idprod_([0-9]+)$/',GETPOST('idprodfournprice'), $reg))
{
$idprod=$reg[1];
$res=$productsupplier->fetch($idprod);
// Call to init properties of $productsupplier
// So if a supplier price already exists for another thirdparty (first one found), we use it as reference price
$productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist
}
elseif (GETPOST('idprodfournprice') > 0)
{
//$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat.
$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch);
$res=$productsupplier->fetch($idprod);
}
if ($idprod > 0)
{
$pu_ht = $productsupplier->fourn_pu;
$price_base_type = $productsupplier->fourn_price_base_type;
$type = $productsupplier->type;
$label = $productsupplier->label;
$desc = $productsupplier->description;
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc);
if ($idprod > 0)
{
$pu_ht = $productsupplier->fourn_pu;
$price_base_type = $productsupplier->fourn_price_base_type;
$type = $productsupplier->type;
$label = $productsupplier->label;
$desc = $productsupplier->description;
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc);
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
if (empty($tva_tx)) $tva_npr=0;
$localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr);
$localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr);
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
if (empty($tva_tx)) $tva_npr=0;
$localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr);
$localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr);
$result=$object->addline(
$desc,
$pu_ht,
$qty,
$tva_tx,
$localtax1_tx,
$localtax2_tx,
$productsupplier->id,
$remise_percent,
$price_base_type,
$pu_ttc,
$tva_npr,
$type,
-1,
0,
GETPOST('fk_parent_line'),
$fournprice,
$buyingprice,
$label,
$array_options,
$ref_fourn,
$fk_unit
);
//var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit;
}
if ($idprod == -99 || $idprod == 0)
{
// Product not selected
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProductOrService")).' '.$langs->trans("or").' '.$langs->trans("NoPriceDefinedForThisSupplier"), null, 'errors');
}
if ($idprod == -1)
{
// Quantity too low
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors');
}
$result=$object->addline(
$desc,
$pu_ht,
$qty,
$tva_tx,
$localtax1_tx,
$localtax2_tx,
$productsupplier->id,
$remise_percent,
$price_base_type,
$pu_ttc,
$tva_npr,
$type,
-1,
0,
GETPOST('fk_parent_line'),
$fournprice,
$buyingprice,
$label,
$array_options,
$ref_fourn,
$fk_unit
);
//var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit;
}
if ($idprod == -99 || $idprod == 0)
{
// Product not selected
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProductOrService")).' '.$langs->trans("or").' '.$langs->trans("NoPriceDefinedForThisSupplier"), null, 'errors');
}
if ($idprod == -1)
{
// Quantity too low
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors');
}
}
else if((GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='') && empty($error)) // Free product
{
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
$tva_tx = str_replace('*', '', $tva_tx);
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
$desc = $product_desc;
$type = GETPOST('type');
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
$tva_tx = str_replace('*', '', $tva_tx);
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
$desc = $product_desc;
$type = GETPOST('type');
$fk_unit= GETPOST('units', 'alpha');
$fk_unit= GETPOST('units', 'alpha');
$tva_tx = price2num($tva_tx); // When vat is text input field
$tva_tx = price2num($tva_tx); // When vat is text input field
// Local Taxes
$localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
$localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
// Local Taxes
$localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
$localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
if (GETPOST('price_ht')!=='')
{
$price_base_type = 'HT';
$ht = price2num(GETPOST('price_ht'));
$ttc = 0;
}
else
{
$ttc = price2num(GETPOST('price_ttc'));
$ht = $ttc / (1 + ($tva_tx / 100));
$price_base_type = 'HT';
}
if (GETPOST('price_ht')!=='')
{
$price_base_type = 'HT';
$ht = price2num(GETPOST('price_ht'));
$ttc = 0;
}
else
{
$ttc = price2num(GETPOST('price_ttc'));
$ht = $ttc / (1 + ($tva_tx / 100));
$price_base_type = 'HT';
}
$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn, $fk_unit);
//$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit);
//$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit);
}
@ -706,9 +706,9 @@ if (empty($reshook))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
@ -716,7 +716,7 @@ if (empty($reshook))
$ret = $object->fetch($id); // Reload to get new records
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) dol_print_error($db,$result);
if ($result < 0) dol_print_error($db,$result);
}
unset($_POST['prod_entry_mode']);
@ -729,7 +729,7 @@ if (empty($reshook))
unset($_POST['multicurrency_price_ht']);
unset($_POST['price_ttc']);
unset($_POST['tva_tx']);
unset($_POST['label']);
unset($_POST['label']);
unset($_POST['product_ref']);
unset($_POST['product_label']);
unset($_POST['product_desc']);
@ -958,9 +958,9 @@ $now = dol_now();
// Add new askprice
if ($action == 'create')
{
$currency_code = $conf->currency;
$currency_code = $conf->currency;
print load_fiche_titre($langs->trans("NewAskPrice"));
print load_fiche_titre($langs->trans("NewAskPrice"));
$soc = new Societe($db);
if ($socid > 0)
@ -997,8 +997,8 @@ if ($action == 'create')
if (!empty($conf->multicurrency->enabled))
{
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
}
}
else
@ -1036,7 +1036,7 @@ if ($action == 'create')
} else {
print '<td colspan="2">';
print $form->select_company('', 'socid', 's.fournisseur = 1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=0&fournisseur=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=0&fournisseur=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
print '</td>';
}
print '</tr>' . "\n";
@ -1051,19 +1051,19 @@ if ($action == 'create')
$form->select_types_paiements(GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id');
print '</td></tr>';
// Bank Account
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) {
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
$form->select_comptes(GETPOST('fk_account')>0 ? GETPOST('fk_account','int') : $fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
}
// Bank Account
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) {
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
$form->select_comptes(GETPOST('fk_account')>0 ? GETPOST('fk_account','int') : $fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
}
// Shipping Method
if (! empty($conf->expedition->enabled)) {
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td colspan="2">';
print $form->selectShippingMethod(GETPOST('shipping_method_id') > 0 ? GETPOST('shipping_method_id', 'int') : $shipping_method_id, 'shipping_method_id', '', 1);
print '</td></tr>';
}
// Shipping Method
if (! empty($conf->expedition->enabled)) {
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td colspan="2">';
print $form->selectShippingMethod(GETPOST('shipping_method_id') > 0 ? GETPOST('shipping_method_id', 'int') : $shipping_method_id, 'shipping_method_id', '', 1);
print '</td></tr>';
}
// Delivery date (or manufacturing)
print '<tr><td>' . $langs->trans("DeliveryDate") . '</td>';
@ -1115,15 +1115,15 @@ if ($action == 'create')
{
print '<tr>';
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '<td colspan="3" class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '</td></tr>';
}
// Other attributes
$parameters = array('colspan' => ' colspan="3"');
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $object->showOptionals($extrafields, 'edit');
}
@ -1181,7 +1181,7 @@ if ($action == 'create')
if (! empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE))
{
print '<br><table>';
print '<br><table>';
// For backward compatibility
print '<tr>';
@ -1339,34 +1339,34 @@ if ($action == 'create')
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->supplier_proposal->creer)
{
if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} 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);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->supplier_proposal->creer)
{
if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} 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);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
@ -1468,17 +1468,17 @@ if ($action == 'create')
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
if($action == 'actualizemulticurrencyrate') {
if($action == 'actualizemulticurrencyrate') {
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
}
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
}
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
} else {
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
print '</div>';
}
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
print '</div>';
}
}
print '</td></tr>';
}
@ -1498,22 +1498,22 @@ if ($action == 'create')
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled))
{
// Bank Account
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('BankAccount');
print '</td>';
if ($action != 'editbankaccount' && $user->rights->supplier_proposal->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
} else {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
}
print '</td>';
print '</tr>';
// Bank Account
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('BankAccount');
print '</td>';
if ($action != 'editbankaccount' && $user->rights->supplier_proposal->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
} else {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
}
print '</td>';
print '</tr>';
}
// Other attributes
@ -1619,7 +1619,7 @@ if ($action == 'create')
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
print '<div class="div-table-responsive-no-min">';
print '<div class="div-table-responsive-no-min">';
print '<table id="tablelines" class="noborder noshadow" width="100%">';
// Add free products/services form
@ -1643,7 +1643,7 @@ if ($action == 'create')
}
print '</table>';
print '</div>';
print '</div>';
print "</form>\n";
dol_fiche_end();
@ -1684,15 +1684,15 @@ if ($action == 'create')
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
// modified by hook
if (empty($reshook))
{
if ($action != 'statut' && $action != 'editline')
{
// Validate
if ($object->statut == SupplierProposal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0 &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->supplier_proposal->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->supplier_proposal->validate_advance)))
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->supplier_proposal->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->supplier_proposal->validate_advance)))
) {
if (count($object->lines) > 0)
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>';
@ -1733,8 +1733,8 @@ if ($action == 'create')
// Close
if ($object->statut == SupplierProposal::STATUS_SIGNED && $user->rights->supplier_proposal->cloturer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=close' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
print '>' . $langs->trans('Close') . '</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=close' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
print '>' . $langs->trans('Close') . '</a></div>';
}
// Clone

View File

@ -313,7 +313,7 @@ if ($action == 'add')
}
*/
//$filename = 'image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $linkwithoutdomain)?'':'/').$linkwithoutdomain;
//$filename = 'image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $linkwithoutdomain)?'':'/').$linkwithoutdomain;
$tmp = preg_replace('/'.preg_quote($regs[0][$key],'/').'/i', '', $tmp);
}
$objectpage->htmlheader = trim($tmp);

View File

@ -32,7 +32,7 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit(-1);
}
@ -116,10 +116,10 @@ if ($resql)
$sql2 = "SELECT mc.rowid, mc.lastname as lastname, mc.firstname as firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
$sql2.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql2.= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$id;
if ($conf->global->MAILING_LIMIT_SENDBYCLI > 0)
{
$sql2.= " LIMIT ".$conf->global->MAILING_LIMIT_SENDBYCLI;
}
if ($conf->global->MAILING_LIMIT_SENDBYCLI > 0)
{
$sql2.= " LIMIT ".$conf->global->MAILING_LIMIT_SENDBYCLI;
}
$resql2=$db->query($sql2);
if ($resql2)
@ -157,31 +157,31 @@ if ($resql)
// Make subtsitutions on topic and body
$other=explode(';',$obj2->other);
$tmpfield=explode('=',$other[0],2); $other1=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[1],2); $other2=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:'');
$tmpfield=explode('=',$other[1],2); $other2=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:'');
$object = null; // Not defined with mass emailing
$parameters=array('mode'=>'emailing');
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'), $object); // Note: On mass emailing, this is null because we don't know object
$object = null; // Not defined with mass emailing
$parameters=array('mode'=>'emailing');
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'), $object); // Note: On mass emailing, this is null because we don't know object
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$substitutionarray['__ID__'] = $obj->source_id;
$substitutionarray['__EMAIL__'] = $obj->email;
$substitutionarray['__LASTNAME__'] = $obj->lastname;
$substitutionarray['__FIRSTNAME__'] = $obj->firstname;
$substitutionarray['__MAILTOEMAIL__'] = '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>';
$substitutionarray['__OTHER1__'] = $other1;
$substitutionarray['__OTHER2__'] = $other2;
$substitutionarray['__OTHER3__'] = $other3;
$substitutionarray['__OTHER4__'] = $other4;
$substitutionarray['__OTHER5__'] = $other5;
$substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$substitutionarray['__ID__'] = $obj->source_id;
$substitutionarray['__EMAIL__'] = $obj->email;
$substitutionarray['__LASTNAME__'] = $obj->lastname;
$substitutionarray['__FIRSTNAME__'] = $obj->firstname;
$substitutionarray['__MAILTOEMAIL__'] = '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>';
$substitutionarray['__OTHER1__'] = $other1;
$substitutionarray['__OTHER2__'] = $other2;
$substitutionarray['__OTHER3__'] = $other3;
$substitutionarray['__OTHER4__'] = $other4;
$substitutionarray['__OTHER5__'] = $other5;
$substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
$substitutionarray['__SIGNATURE__'] = $signature; // For backward compatibility
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
$substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>';
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
$substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>';
$onlinepaymentenabled = 0;
if (! empty($conf->paypal->enabled)) $onlinepaymentenabled++;
@ -232,22 +232,22 @@ if ($resql)
// Fabrication du mail
$trackid='emailing-'.$obj2->source_type.$obj2->source_id;
$mail = new CMailFile(
$newsubject,
$sendto,
$from,
$newmessage,
array(),
array(),
array(),
'',
'',
0,
$msgishtml,
$errorsto,
'',
$trackid,
'',
'emailing'
$newsubject,
$sendto,
$from,
$newmessage,
array(),
array(),
array(),
'',
'',
0,
$msgishtml,
$errorsto,
'',
$trackid,
'',
'emailing'
);
if ($mail->error)
@ -314,7 +314,7 @@ if ($resql)
$error++;
}
//Update status communication of contact prospect
//Update status communication of contact prospect
$sqlx = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj2->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
dol_syslog("card.php: set prospect contact status", LOG_DEBUG);
@ -326,9 +326,9 @@ if ($resql)
}
}
if (!empty($conf->global->MAILING_DELAY)) {
sleep($conf->global->MAILING_DELAY);
}
if (!empty($conf->global->MAILING_DELAY)) {
sleep($conf->global->MAILING_DELAY);
}
}
}