Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
1c647e2898
@ -385,7 +385,7 @@ print '<tr class="oddeven">'."\n";
|
|||||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
||||||
print '<td align="center"> </td>'."\n";
|
print '<td align="center"> </td>'."\n";
|
||||||
print '<td align="right">'."\n";
|
print '<td align="right">'."\n";
|
||||||
$tmplist=array('show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_list'=>$langs->trans("ViewList"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
|||||||
@ -131,9 +131,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
|||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg))
|
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$regmod))
|
||||||
{
|
{
|
||||||
$module = strtolower($reg[1]);
|
$module = strtolower($regmod[1]);
|
||||||
$moduledirforclass = getModuleDirForApiClass($module);
|
$moduledirforclass = getModuleDirForApiClass($module);
|
||||||
$moduleforperm = $module;
|
$moduleforperm = $module;
|
||||||
if ($module == 'propale') { $moduleforperm='propal'; }
|
if ($module == 'propale') { $moduleforperm='propal'; }
|
||||||
@ -159,9 +159,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
|||||||
if ($file_searched == 'api_access.class.php') continue;
|
if ($file_searched == 'api_access.class.php') continue;
|
||||||
|
|
||||||
// Support of the deprecated API.
|
// Support of the deprecated API.
|
||||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
|
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$regapi))
|
||||||
{
|
{
|
||||||
$classname = ucwords($reg[1]).'Api';
|
$classname = ucwords($regapi[1]).'Api';
|
||||||
require_once $dir_part.$file_searched;
|
require_once $dir_part.$file_searched;
|
||||||
if (class_exists($classname))
|
if (class_exists($classname))
|
||||||
{
|
{
|
||||||
@ -173,9 +173,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
|||||||
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
|
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$regapi))
|
||||||
{
|
{
|
||||||
$classname = ucwords($reg[1]);
|
$classname = ucwords($regapi[1]);
|
||||||
$classname = str_replace('_', '', $classname);
|
$classname = str_replace('_', '', $classname);
|
||||||
require_once $dir_part.$file_searched;
|
require_once $dir_part.$file_searched;
|
||||||
if (class_exists($classname))
|
if (class_exists($classname))
|
||||||
@ -206,7 +206,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call one APIs or one definition of an API
|
// Call one APIs or one definition of an API
|
||||||
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis))))
|
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis) && $regbis[1] != 'root')))
|
||||||
{
|
{
|
||||||
$module = $reg[1];
|
$module = $reg[1];
|
||||||
if ($module == 'explorer') // If we call page to explore details of a service
|
if ($module == 'explorer') // If we call page to explore details of a service
|
||||||
|
|||||||
@ -49,6 +49,7 @@ class Categorie extends CommonObject
|
|||||||
const TYPE_MEMBER = 3; // TODO Replace this value with 'member'
|
const TYPE_MEMBER = 3; // TODO Replace this value with 'member'
|
||||||
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
|
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
|
||||||
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
||||||
|
|
||||||
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
||||||
const TYPE_PROJECT = 6;
|
const TYPE_PROJECT = 6;
|
||||||
const TYPE_BANK_LINE = 'bank_line';
|
const TYPE_BANK_LINE = 'bank_line';
|
||||||
@ -1174,11 +1175,11 @@ class Categorie extends CommonObject
|
|||||||
*/
|
*/
|
||||||
if($obj[0] > 0 && $obj[0] != $this->id)
|
if($obj[0] > 0 && $obj[0] != $this->id)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::already_exists category with name=".$this->label." exist rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
dol_syslog(get_class($this)."::already_exists category with name=".$this->label." and parent ".$this->fk_parent." exists: rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." and same parent ".$this->fk_parent.": rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -59,9 +59,9 @@ else
|
|||||||
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||||
$search_title=GETPOST('search_title','alpha');
|
$search_title=GETPOST('search_title','alpha');
|
||||||
|
|
||||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
|
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
|
||||||
$datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth'), GETPOST('datestartday'), GETPOST('datestartyear'));
|
$datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth','int'), GETPOST('datestartday','int'), GETPOST('datestartyear','int'));
|
||||||
$dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth'), GETPOST('dateendday'), GETPOST('dateendyear'));
|
$dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth','int'), GETPOST('dateendday','int'), GETPOST('dateendyear','int'));
|
||||||
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||||
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con
|
|||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($actioncode != '') $param.="&actioncode=".$actioncode;
|
if ($actioncode != '') $param.="&actioncode=".$actioncode;
|
||||||
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
||||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
if ($status != '' && $status > -1) $param.="&status=".$status;
|
||||||
if ($filter) $param.="&filter=".$filter;
|
if ($filter) $param.="&filter=".$filter;
|
||||||
if ($filtert) $param.="&filtert=".$filtert;
|
if ($filtert) $param.="&filtert=".$filtert;
|
||||||
if ($socid) $param.="&socid=".$socid;
|
if ($socid) $param.="&socid=".$socid;
|
||||||
@ -177,6 +177,13 @@ if ($pid) $param.="&projectid=".$pid;
|
|||||||
if ($type) $param.="&type=".$type;
|
if ($type) $param.="&type=".$type;
|
||||||
if ($usergroup) $param.="&usergroup=".$usergroup;
|
if ($usergroup) $param.="&usergroup=".$usergroup;
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
|
if ($search_title != '') $param.='&search_title='.$search_title;
|
||||||
|
if (GETPOST('datestartday','int')) $param.='&datestartday='.GETPOST('datestartday','int');
|
||||||
|
if (GETPOST('datestartmonth','int')) $param.='&datestartmonth='.GETPOST('datestartmonth','int');
|
||||||
|
if (GETPOST('datestartyear','int')) $param.='&datestartyear='.GETPOST('datestartyear','int');
|
||||||
|
if (GETPOST('dateendday','int')) $param.='&dateendday='.GETPOST('dateendday','int');
|
||||||
|
if (GETPOST('dateendmonth','int')) $param.='&dateendmonth='.GETPOST('dateendmonth','int');
|
||||||
|
if (GETPOST('dateendyear','int')) $param.='&dateendyear='.GETPOST('dateendyear','int');
|
||||||
|
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
if ($usergroup > 0) $sql.=" DISTINCT";
|
if ($usergroup > 0) $sql.=" DISTINCT";
|
||||||
|
|||||||
@ -1411,7 +1411,7 @@ class Commande extends CommonOrder
|
|||||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la commande meme
|
// Mise a jour informations denormalisees au niveau de la commande meme
|
||||||
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
$result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
@ -475,7 +475,13 @@ class FactureRec extends CommonInvoice
|
|||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$rowid;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$rowid;
|
||||||
dol_syslog($sql);
|
dol_syslog($sql);
|
||||||
if (! $this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
// Delete linked object
|
||||||
|
$res = $this->deleteObjectLinked();
|
||||||
|
if ($res < 0) $error=-3;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
$error=-1;
|
$error=-1;
|
||||||
|
|||||||
@ -320,34 +320,6 @@ abstract class CommonDocGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define array with couple subtitution key => subtitution value
|
|
||||||
*
|
|
||||||
* @param Object $object Dolibarr Object
|
|
||||||
* @param Translate $outputlangs Language object for output
|
|
||||||
* @param boolean $recursive Want to fetch child array or child object
|
|
||||||
* @return array Array of substitution key->code
|
|
||||||
*/
|
|
||||||
function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true) {
|
|
||||||
$array_other = array();
|
|
||||||
if(!empty($object)) {
|
|
||||||
foreach($object as $key => $value) {
|
|
||||||
if(!empty($value)) {
|
|
||||||
if(!is_array($value) && !is_object($value)) {
|
|
||||||
$array_other['object_'.$key] = $value;
|
|
||||||
}
|
|
||||||
if(is_array($value) && $recursive){
|
|
||||||
$array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value,$outputlangs,false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $array_other;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define array with couple substitution key => substitution value
|
* Define array with couple substitution key => substitution value
|
||||||
*
|
*
|
||||||
@ -410,6 +382,15 @@ abstract class CommonDocGenerator
|
|||||||
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
||||||
$array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()),
|
$array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()),
|
||||||
|
|
||||||
|
$array_key.'_multicurrency_code' => price2num($object->multicurrency_code),
|
||||||
|
$array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx),
|
||||||
|
$array_key.'_multicurrency_total_ht' => price2num($object->multicurrency_total_ht),
|
||||||
|
$array_key.'_multicurrency_total_tva' => price2num($object->multicurrency_total_tva),
|
||||||
|
$array_key.'_multicurrency_total_ttc' => price2num($object->multicurrency_total_ttc),
|
||||||
|
$array_key.'_multicurrency_total_ht_locale' => price($object->multicurrency_total_ht, 0, $outputlangs),
|
||||||
|
$array_key.'_multicurrency_total_tva_locale' => price($object->multicurrency_total_tva, 0, $outputlangs),
|
||||||
|
$array_key.'_multicurrency_total_ttc_locale' => price($object->multicurrency_total_ttc, 0, $outputlangs),
|
||||||
|
|
||||||
$array_key.'_note_private'=>$object->note,
|
$array_key.'_note_private'=>$object->note,
|
||||||
$array_key.'_note_public'=>$object->note_public,
|
$array_key.'_note_public'=>$object->note_public,
|
||||||
$array_key.'_note'=>$object->note_public, // For backward compatibility
|
$array_key.'_note'=>$object->note_public, // For backward compatibility
|
||||||
@ -423,7 +404,7 @@ abstract class CommonDocGenerator
|
|||||||
$array_key.'_already_creditnote'=>price2num($sumcreditnote),
|
$array_key.'_already_creditnote'=>price2num($sumcreditnote),
|
||||||
|
|
||||||
$array_key.'_already_payed_all_locale'=>price(price2num($sumpayed + $sumdeposit + $sumcreditnote, 'MT'), 0, $outputlangs),
|
$array_key.'_already_payed_all_locale'=>price(price2num($sumpayed + $sumdeposit + $sumcreditnote, 'MT'), 0, $outputlangs),
|
||||||
$array_key.'already_payed_all'=> price2num(($sumpayed + $sumdeposit + $sumcreditnote), 'MT'),
|
$array_key.'_already_payed_all'=> price2num(($sumpayed + $sumdeposit + $sumcreditnote), 'MT'),
|
||||||
|
|
||||||
// Remain to pay with all know infrmation (except open direct debit requests)
|
// Remain to pay with all know infrmation (except open direct debit requests)
|
||||||
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT'), 0, $outputlangs),
|
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT'), 0, $outputlangs),
|
||||||
@ -493,6 +474,16 @@ abstract class CommonDocGenerator
|
|||||||
'line_date_end'=>dol_print_date($line->date_end, 'day', 'tzuser'),
|
'line_date_end'=>dol_print_date($line->date_end, 'day', 'tzuser'),
|
||||||
'line_date_end_locale'=>dol_print_date($line->date_end, 'day', 'tzuser', $outputlangs),
|
'line_date_end_locale'=>dol_print_date($line->date_end, 'day', 'tzuser', $outputlangs),
|
||||||
'line_date_end_rfc'=>dol_print_date($line->date_end, 'dayrfc', 'tzuser'),
|
'line_date_end_rfc'=>dol_print_date($line->date_end, 'dayrfc', 'tzuser'),
|
||||||
|
|
||||||
|
'line_multicurrency_code' => price2num($line->multicurrency_code),
|
||||||
|
'line_multicurrency_subprice' => price2num($line->multicurrency_subprice),
|
||||||
|
'line_multicurrency_total_ht' => price2num($line->multicurrency_total_ht),
|
||||||
|
'line_multicurrency_total_tva' => price2num($line->multicurrency_total_tva),
|
||||||
|
'line_multicurrency_total_ttc' => price2num($line->multicurrency_total_ttc),
|
||||||
|
'line_multicurrency_subprice_locale' => price($line->multicurrency_subprice, 0, $outputlangs),
|
||||||
|
'line_multicurrency_total_ht_locale' => price($line->multicurrency_total_ht, 0, $outputlangs),
|
||||||
|
'line_multicurrency_total_tva_locale' => price($line->multicurrency_total_tva, 0, $outputlangs),
|
||||||
|
'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Retrieve extrafields
|
// Retrieve extrafields
|
||||||
@ -601,6 +592,33 @@ abstract class CommonDocGenerator
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define array with couple subtitution key => subtitution value
|
||||||
|
*
|
||||||
|
* @param Object $object Dolibarr Object
|
||||||
|
* @param Translate $outputlangs Language object for output
|
||||||
|
* @param boolean $recursive Want to fetch child array or child object
|
||||||
|
* @return array Array of substitution key->code
|
||||||
|
*/
|
||||||
|
function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true) {
|
||||||
|
$array_other = array();
|
||||||
|
if(!empty($object)) {
|
||||||
|
foreach($object as $key => $value) {
|
||||||
|
if(!empty($value)) {
|
||||||
|
if(!is_array($value) && !is_object($value)) {
|
||||||
|
$array_other['object_'.$key] = $value;
|
||||||
|
}
|
||||||
|
if(is_array($value) && $recursive){
|
||||||
|
$array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value,$outputlangs,false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $array_other;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill array with couple extrafield key => extrafield value
|
* Fill array with couple extrafield key => extrafield value
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2463,12 +2463,12 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
|
|||||||
* MAIN_DISABLE_TRUNC=1 can disable all truncings
|
* MAIN_DISABLE_TRUNC=1 can disable all truncings
|
||||||
*
|
*
|
||||||
* @param string $string String to truncate
|
* @param string $string String to truncate
|
||||||
* @param int $size Max string size visible. 0 for no limit. Final string size can be 1 more (if size was max+1) or 3 more (if we added ...)
|
* @param int $size Max string size visible (excluding ...). 0 for no limit. WARNING: Final string size can have 3 more chars (if we added ..., or if size was max+1 or max+2 or max+3 so it does not worse to replace with ...)
|
||||||
* @param string $trunc Where to trunc: right, left, middle (size must be a 2 power), wrap
|
* @param string $trunc Where to trunc: right, left, middle (size must be a 2 power), wrap
|
||||||
* @param string $stringencoding Tell what is source string encoding
|
* @param string $stringencoding Tell what is source string encoding
|
||||||
* @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation.
|
* @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation.
|
||||||
* @param int $display Trunc is use to display and can be changed for small screen. TODO Remove this param (must be dealt with CSS)
|
* @param int $display Trunc is use to display and can be changed for small screen. TODO Remove this param (must be dealt with CSS)
|
||||||
* @return string Truncated string
|
* @return string Truncated string. WARNING: length is never higher than $size if $nodot is set, but can be 3 chars higher otherwise.
|
||||||
*/
|
*/
|
||||||
function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0, $display=0)
|
function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0, $display=0)
|
||||||
{
|
{
|
||||||
@ -2484,9 +2484,10 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
|||||||
if ($trunc == 'right')
|
if ($trunc == 'right')
|
||||||
{
|
{
|
||||||
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
|
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
|
||||||
if (dol_strlen($newstring,$stringencoding) > ($size+($nodot?0:1)))
|
if (dol_strlen($newstring,$stringencoding) > ($size+($nodot?0:3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
|
||||||
return dol_substr($newstring,0,$size,$stringencoding).($nodot?'':'...');
|
return dol_substr($newstring,0,$size,$stringencoding).($nodot?'':'...');
|
||||||
else
|
else
|
||||||
|
//return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string;
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
elseif ($trunc == 'middle')
|
elseif ($trunc == 'middle')
|
||||||
@ -2504,7 +2505,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
|||||||
elseif ($trunc == 'left')
|
elseif ($trunc == 'left')
|
||||||
{
|
{
|
||||||
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
|
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
|
||||||
if (dol_strlen($newstring,$stringencoding) > ($size+1))
|
if (dol_strlen($newstring,$stringencoding) > ($size+($nodot?0:3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
|
||||||
return '...'.dol_substr($newstring,dol_strlen($newstring,$stringencoding) - $size,$size,$stringencoding);
|
return '...'.dol_substr($newstring,dol_strlen($newstring,$stringencoding) - $size,$size,$stringencoding);
|
||||||
else
|
else
|
||||||
return $string;
|
return $string;
|
||||||
|
|||||||
@ -1508,11 +1508,11 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
|
|
||||||
// Clean
|
// Clean
|
||||||
if (empty($visible)) $visible='0';
|
if (empty($visible)) $visible='0';
|
||||||
if (empty($val)) $val='';
|
if (empty($val) && $val != '0') $val='';
|
||||||
|
|
||||||
$sql = "SELECT count(*)";
|
$sql = "SELECT count(*)";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."const";
|
$sql.= " FROM ".MAIN_DB_PREFIX."const";
|
||||||
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$name."'";
|
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($name)."'";
|
||||||
$sql.= " AND entity = ".$entity;
|
$sql.= " AND entity = ".$entity;
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
@ -1526,7 +1526,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
$sql.= " VALUES (";
|
$sql.= " VALUES (";
|
||||||
$sql.= $this->db->encrypt($name,1);
|
$sql.= $this->db->encrypt($name,1);
|
||||||
$sql.= ",'".$type."'";
|
$sql.= ",'".$type."'";
|
||||||
$sql.= ",".($val?$this->db->encrypt($val,1):"''");
|
$sql.= ",".(($val != '')?$this->db->encrypt($val,1):"''");
|
||||||
$sql.= ",".($note?"'".$this->db->escape($note)."'":"null");
|
$sql.= ",".($note?"'".$this->db->escape($note)."'":"null");
|
||||||
$sql.= ",'".$visible."'";
|
$sql.= ",'".$visible."'";
|
||||||
$sql.= ",".$entity;
|
$sql.= ",".$entity;
|
||||||
|
|||||||
@ -146,7 +146,7 @@ class pdf_einstein extends ModelePDFCommandes
|
|||||||
}
|
}
|
||||||
$this->posxdiscount=162;
|
$this->posxdiscount=162;
|
||||||
$this->postotalht=174;
|
$this->postotalht=174;
|
||||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup;
|
||||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||||
if ($this->page_largeur < 210) // To work with US executive format
|
if ($this->page_largeur < 210) // To work with US executive format
|
||||||
{
|
{
|
||||||
|
|||||||
@ -132,7 +132,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$this->posxdiscount=162;
|
$this->posxdiscount=162;
|
||||||
$this->posxprogress=126; // Only displayed for situation invoices
|
$this->posxprogress=126; // Only displayed for situation invoices
|
||||||
$this->postotalht=174;
|
$this->postotalht=174;
|
||||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup;
|
||||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||||
if ($this->page_largeur < 210) // To work with US executive format
|
if ($this->page_largeur < 210) // To work with US executive format
|
||||||
{
|
{
|
||||||
|
|||||||
@ -120,7 +120,7 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
}
|
}
|
||||||
$this->posxdiscount=162;
|
$this->posxdiscount=162;
|
||||||
$this->postotalht=174;
|
$this->postotalht=174;
|
||||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup;
|
||||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||||
if ($this->page_largeur < 210) // To work with US executive format
|
if ($this->page_largeur < 210) // To work with US executive format
|
||||||
{
|
{
|
||||||
|
|||||||
@ -108,7 +108,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||||||
$this->posxqty=145;
|
$this->posxqty=145;
|
||||||
$this->posxdiscount=162;
|
$this->posxdiscount=162;
|
||||||
$this->postotalht=174;
|
$this->postotalht=174;
|
||||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup;
|
||||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||||
if ($this->page_largeur < 210) // To work with US executive format
|
if ($this->page_largeur < 210) // To work with US executive format
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1553,7 +1553,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la commande meme
|
// Mise a jour informations denormalisees au niveau de la commande meme
|
||||||
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
$result=$this->update_price(1,'auto',0,$this->thirdparty); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
@ -1430,7 +1430,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la facture meme
|
// Mise a jour informations denormalisees au niveau de la facture meme
|
||||||
$result=$this->update_price(1,'auto',0,$mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
|
$result=$this->update_price(1,'auto',0,$this->thirdparty); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
@ -75,6 +75,9 @@ InterventionSentByEMail=Intervention %s sent by EMail
|
|||||||
ProposalDeleted=Proposal deleted
|
ProposalDeleted=Proposal deleted
|
||||||
OrderDeleted=Order deleted
|
OrderDeleted=Order deleted
|
||||||
InvoiceDeleted=Invoice deleted
|
InvoiceDeleted=Invoice deleted
|
||||||
|
PRODUCT_CREATEInDolibarr=Product %s created
|
||||||
|
PRODUCT_MODIFYInDolibarr=Product %s modified
|
||||||
|
PRODUCT_DELETEInDolibarr=Product %s deleted
|
||||||
##### End agenda events #####
|
##### End agenda events #####
|
||||||
AgendaModelModule=Document templates for event
|
AgendaModelModule=Document templates for event
|
||||||
DateActionStart=Start date
|
DateActionStart=Start date
|
||||||
|
|||||||
@ -358,6 +358,7 @@ TotalLT1ES=Total RE
|
|||||||
TotalLT2ES=Total IRPF
|
TotalLT2ES=Total IRPF
|
||||||
HT=Net of tax
|
HT=Net of tax
|
||||||
TTC=Inc. tax
|
TTC=Inc. tax
|
||||||
|
INCT=Inc. all taxes
|
||||||
VAT=Sales tax
|
VAT=Sales tax
|
||||||
VATs=Sales taxes
|
VATs=Sales taxes
|
||||||
LT1ES=RE
|
LT1ES=RE
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
*/
|
*/
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_expression.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_expression.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
|
||||||
@ -759,12 +760,8 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
print '<td style="text-align: right">'.$langs->trans("MinPrice").'</td>';
|
print '<td style="text-align: right">'.$langs->trans("MinPrice").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var=True;
|
|
||||||
|
|
||||||
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
|
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
|
||||||
{
|
{
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Label of price
|
// Label of price
|
||||||
@ -1244,11 +1241,8 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
|||||||
|
|
||||||
print '<tbody>';
|
print '<tbody>';
|
||||||
|
|
||||||
$var = false;
|
|
||||||
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
||||||
{
|
{
|
||||||
$var = !$var;
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->textwithpicto($langs->trans('SellingPrice') . ' ' . $i, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
print $form->textwithpicto($langs->trans('SellingPrice') . ' ' . $i, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||||
@ -1389,13 +1383,12 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
|||||||
|
|
||||||
$notfirstlineforlevel=array();
|
$notfirstlineforlevel=array();
|
||||||
|
|
||||||
$var = True;
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var = ! $var;
|
|
||||||
print '<tr '. $bc[$var].'>';
|
print '<tr class="oddeven">';
|
||||||
// Date
|
// Date
|
||||||
print "<td>" . dol_print_date($db->jdate($objp->dp), "dayhour") . "</td>";
|
print "<td>" . dol_print_date($db->jdate($objp->dp), "dayhour") . "</td>";
|
||||||
|
|
||||||
@ -1440,7 +1433,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
|||||||
print '<td align="right"></td>';
|
print '<td align="right"></td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td align="right">' . ($objp->price_base_type != 'TTC' ? price($objp->price_min) : '') . '</td>';
|
print '<td align="right">' . ($objp->price_base_type != 'TTC' ? price($objp->price_min) : '') . '</td>';
|
||||||
|
|
||||||
print '<td align="right">' . ($objp->price_base_type == 'TTC' ? price($objp->price_min_ttc) : '') . '</td>';
|
print '<td align="right">' . ($objp->price_base_type == 'TTC' ? price($objp->price_min_ttc) : '') . '</td>';
|
||||||
|
|
||||||
// User
|
// User
|
||||||
@ -1611,9 +1606,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="update_customer_price_confirm">';
|
print '<input type="hidden" name="action" value="update_customer_price_confirm">';
|
||||||
print '<input type="hidden" name="lineid" value="' . $prodcustprice->id . '">';
|
print '<input type="hidden" name="lineid" value="' . $prodcustprice->id . '">';
|
||||||
|
|
||||||
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>' . $langs->trans('ThirdParty') . '</td>';
|
print '<td class="titlefield">' . $langs->trans('ThirdParty') . '</td>';
|
||||||
$staticsoc = new Societe($db);
|
$staticsoc = new Societe($db);
|
||||||
$staticsoc->fetch($prodcustprice->fk_soc);
|
$staticsoc->fetch($prodcustprice->fk_soc);
|
||||||
print "<td colspan='2'>" . $staticsoc->getNomUrl(1) . "</td>";
|
print "<td colspan='2'>" . $staticsoc->getNomUrl(1) . "</td>";
|
||||||
@ -1625,7 +1623,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Price base
|
// Price base
|
||||||
print '<tr><td width="15%">';
|
print '<tr><td>';
|
||||||
print $langs->trans('PriceBase');
|
print $langs->trans('PriceBase');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1634,7 +1632,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Price
|
// Price
|
||||||
print '<tr><td width="20%">';
|
print '<tr><td>';
|
||||||
$text = $langs->trans('SellingPrice');
|
$text = $langs->trans('SellingPrice');
|
||||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -1663,7 +1661,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Update all child soc
|
// Update all child soc
|
||||||
print '<tr><td width="15%">';
|
print '<tr><td>';
|
||||||
print $langs->trans('ForceUpdateChildPriceSoc');
|
print $langs->trans('ForceUpdateChildPriceSoc');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1673,7 +1671,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br><div class="center">';
|
dol_fiche_end();
|
||||||
|
|
||||||
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
||||||
@ -1683,6 +1683,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
}
|
}
|
||||||
elseif ($action == 'showlog_customer_price')
|
elseif ($action == 'showlog_customer_price')
|
||||||
{
|
{
|
||||||
|
// List of all log of prices by customers
|
||||||
|
print '<!-- list of all lof of prices per customer -->'."\n";
|
||||||
|
|
||||||
$filter = array('t.fk_product' => $object->id,'t.fk_soc' => GETPOST('socid', 'int'));
|
$filter = array('t.fk_product' => $object->id,'t.fk_soc' => GETPOST('socid', 'int'));
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
@ -1710,7 +1713,6 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
|
|
||||||
if (count($prodcustprice->lines) > 0)
|
if (count($prodcustprice->lines) > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||||
|
|
||||||
@ -1723,31 +1725,53 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
print '<td align="right">' . $langs->trans("VATRate") . '</td>';
|
print '<td align="right">' . $langs->trans("VATRate") . '</td>';
|
||||||
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
||||||
print '<td align="right">' . $langs->trans("TTC") . '</td>';
|
print '<td align="right">' . $langs->trans("TTC") . '</td>';
|
||||||
|
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '<td align="right">' . $langs->trans("INCT") . '</td>';
|
||||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '</td>';
|
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '</td>';
|
||||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '</td>';
|
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '</td>';
|
||||||
print '<td align="right">' . $langs->trans("ChangedBy") . '</td>';
|
print '<td align="right">' . $langs->trans("ChangedBy") . '</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var = True;
|
|
||||||
|
|
||||||
foreach ($prodcustprice->lines as $line)
|
foreach ($prodcustprice->lines as $line)
|
||||||
{
|
{
|
||||||
$var = ! $var;
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
// Date
|
// Date
|
||||||
$staticsoc = new Societe($db);
|
$staticsoc = new Societe($db);
|
||||||
$staticsoc->fetch($line->fk_soc);
|
$staticsoc->fetch($line->fk_soc);
|
||||||
|
|
||||||
print "<td>" . $staticsoc->getNomUrl(1) . "</td>";
|
|
||||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
|
||||||
|
|
||||||
$tva_tx = $line->default_vat_code ? $line->tva_tx.' ('.$line->default_vat_code.')' : $line->tva_tx;
|
$tva_tx = $line->default_vat_code ? $line->tva_tx.' ('.$line->default_vat_code.')' : $line->tva_tx;
|
||||||
|
|
||||||
|
// Line for default price
|
||||||
|
if ($line->price_base_type=='HT')
|
||||||
|
{
|
||||||
|
$pu=$line->price;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pu=$line->price_ttc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Local tax is not saved into table of product. We use value linked to VAT code.
|
||||||
|
$localtaxarray=getLocalTaxesFromRate($line->tva_tx.($line->default_vat_code?' ('.$line->default_vat_code.')':''), 0, $staticsoc, $mysoc);
|
||||||
|
// Define part of HT, VAT, TTC
|
||||||
|
$resultarray=calcul_price_total(1, $pu, 0, $line->tva_tx, 1, 1, 0, $line->price_base_type, $line->recuperableonly, $object->type, $mysoc, $localtaxarray);
|
||||||
|
// Calcul du total ht sans remise
|
||||||
|
$total_ht = $resultarray[0];
|
||||||
|
$total_vat = $resultarray[1];
|
||||||
|
$total_localtax1 = $resultarray[9];
|
||||||
|
$total_localtax2 = $resultarray[10];
|
||||||
|
$total_ttc = $resultarray[2];
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
print "<td>" . $staticsoc->getNomUrl(1) . "</td>";
|
||||||
|
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||||
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
||||||
print '<td align="right">' . vatrate($tva_tx, true, $line->recuperableonly) . "</td>";
|
print '<td align="right">' . vatrate($tva_tx, true, $line->recuperableonly) . "</td>";
|
||||||
print '<td align="right">' . price($line->price) . "</td>";
|
print '<td align="right">' . price($line->price) . "</td>";
|
||||||
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
||||||
|
|
||||||
|
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '<td align="right">' . price($resultarray[2]) . '</td>';
|
||||||
|
|
||||||
print '<td align="right">' . price($line->price_min) . '</td>';
|
print '<td align="right">' . price($line->price_min) . '</td>';
|
||||||
print '<td align="right">' . price($line->price_min_ttc) . '</td>';
|
print '<td align="right">' . price($line->price_min_ttc) . '</td>';
|
||||||
|
|
||||||
@ -1757,6 +1781,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print $userstatic->getLoginUrl(1);
|
print $userstatic->getLoginUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
} else {
|
} else {
|
||||||
@ -1766,7 +1791,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
else if ($action != 'showlog_default_price' && $action != 'edit_price')
|
else if ($action != 'showlog_default_price' && $action != 'edit_price')
|
||||||
{
|
{
|
||||||
// List of all prices by customers
|
// List of all prices by customers
|
||||||
print '<!-- list of prices per customer -->'."\n";
|
print '<!-- list of all prices per customer -->'."\n";
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
@ -1788,24 +1813,14 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td>' . $langs->trans("ThirdParty") . '</td>';
|
|
||||||
print '<td>' . $langs->trans("AppliedPricesFrom") . '</td>';
|
|
||||||
print '<td align="center">' . $langs->trans("PriceBase") . '</td>';
|
|
||||||
print '<td align="right">' . $langs->trans("VATRate") . '</td>';
|
|
||||||
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
|
||||||
print '<td align="right">' . $langs->trans("TTC") . '</td>';
|
|
||||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '</td>';
|
|
||||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '</td>';
|
|
||||||
print '<td align="right">' . $langs->trans("ChangedBy") . '</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
if (count($prodcustprice->lines) > 0 || $search_soc)
|
if (count($prodcustprice->lines) > 0 || $search_soc)
|
||||||
{
|
{
|
||||||
|
$colspan=8;
|
||||||
|
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") $colspan++;
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_soc" value="' . $search_soc . '" size="20"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat" name="search_soc" value="' . $search_soc . '" size="20"></td>';
|
||||||
print '<td class="liste_titre" colspan="8"> </td>';
|
print '<td class="liste_titre" colspan="'.$colspan.'"> </td>';
|
||||||
// Print the search button
|
// Print the search button
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
@ -1814,10 +1829,41 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$var = False;
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>' . $langs->trans("ThirdParty") . '</td>';
|
||||||
|
print '<td>' . $langs->trans("AppliedPricesFrom") . '</td>';
|
||||||
|
print '<td align="center">' . $langs->trans("PriceBase") . '</td>';
|
||||||
|
print '<td align="right">' . $langs->trans("VATRate") . '</td>';
|
||||||
|
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
||||||
|
print '<td align="right">' . $langs->trans("TTC") . '</td>';
|
||||||
|
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '<td align="right">' . $langs->trans("INCT") . '</td>';
|
||||||
|
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '</td>';
|
||||||
|
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '</td>';
|
||||||
|
print '<td align="right">' . $langs->trans("ChangedBy") . '</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Line for default price
|
// Line for default price
|
||||||
|
if ($object->price_base_type=='HT')
|
||||||
|
{
|
||||||
|
$pu=$object->price;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pu=$object->price_ttc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Local tax is not saved into table of product. We use value linked to VAT code.
|
||||||
|
$localtaxarray=getLocalTaxesFromRate($object->tva_tx.($object->default_vat_code?' ('.$object->default_vat_code.')':''), 0, $mysoc, $mysoc);
|
||||||
|
// Define part of HT, VAT, TTC
|
||||||
|
$resultarray=calcul_price_total(1, $pu, 0, $object->tva_tx, 1, 1, 0, $object->price_base_type, $object->recuperableonly, $object->type, $mysoc, $localtaxarray);
|
||||||
|
// Calcul du total ht sans remise
|
||||||
|
$total_ht = $resultarray[0];
|
||||||
|
$total_vat = $resultarray[1];
|
||||||
|
$total_localtax1 = $resultarray[9];
|
||||||
|
$total_localtax2 = $resultarray[10];
|
||||||
|
$total_ttc = $resultarray[2];
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td>" . $langs->trans("Default") . "</td>";
|
print "<td>" . $langs->trans("Default") . "</td>";
|
||||||
print "<td>" . "</td>";
|
print "<td>" . "</td>";
|
||||||
@ -1827,8 +1873,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
print vatrate($object->tva_tx, true, $object->recuperableonly);
|
print vatrate($object->tva_tx, true, $object->recuperableonly);
|
||||||
print $object->default_vat_code?' ('.$object->default_vat_code.')':'';
|
print $object->default_vat_code?' ('.$object->default_vat_code.')':'';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|
||||||
print '<td align="right">' . price($object->price) . "</td>";
|
print '<td align="right">' . price($object->price) . "</td>";
|
||||||
print '<td align="right">' . price($object->price_ttc) . "</td>";
|
print '<td align="right">' . price($object->price_ttc) . "</td>";
|
||||||
|
|
||||||
|
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '<td align="right">' . price($resultarray[2]) . '</td>';
|
||||||
|
|
||||||
print '<td align="right">' . price($object->price_min) . '</td>';
|
print '<td align="right">' . price($object->price_min) . '</td>';
|
||||||
print '<td align="right">' . price($object->price_min_ttc) . '</td>';
|
print '<td align="right">' . price($object->price_min_ttc) . '</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
@ -1851,19 +1901,37 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
|
|
||||||
if (count($prodcustprice->lines) > 0)
|
if (count($prodcustprice->lines) > 0)
|
||||||
{
|
{
|
||||||
$var = false;
|
|
||||||
foreach ($prodcustprice->lines as $line)
|
foreach ($prodcustprice->lines as $line)
|
||||||
{
|
{
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
$staticsoc = new Societe($db);
|
$staticsoc = new Societe($db);
|
||||||
$staticsoc->fetch($line->fk_soc);
|
$staticsoc->fetch($line->fk_soc);
|
||||||
|
|
||||||
$tva_tx = $line->default_vat_code ? $line->tva_tx.' ('.$line->default_vat_code.')' : $line->tva_tx;
|
$tva_tx = $line->default_vat_code ? $line->tva_tx.' ('.$line->default_vat_code.')' : $line->tva_tx;
|
||||||
|
|
||||||
|
// Line for default price
|
||||||
|
if ($line->price_base_type=='HT')
|
||||||
|
{
|
||||||
|
$pu=$line->price;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pu=$line->price_ttc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Local tax is not saved into table of product. We use value linked to VAT code.
|
||||||
|
$localtaxarray=getLocalTaxesFromRate($line->tva_tx.($line->default_vat_code?' ('.$line->default_vat_code.')':''), 0, $staticsoc, $mysoc);
|
||||||
|
// Define part of HT, VAT, TTC
|
||||||
|
$resultarray=calcul_price_total(1, $pu, 0, $line->tva_tx, 1, 1, 0, $line->price_base_type, $line->recuperableonly, $object->type, $mysoc, $localtaxarray);
|
||||||
|
// Calcul du total ht sans remise
|
||||||
|
$total_ht = $resultarray[0];
|
||||||
|
$total_vat = $resultarray[1];
|
||||||
|
$total_localtax1 = $resultarray[9];
|
||||||
|
$total_localtax2 = $resultarray[10];
|
||||||
|
$total_ttc = $resultarray[2];
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
print "<td>" . $staticsoc->getNomUrl(1) . "</td>";
|
print "<td>" . $staticsoc->getNomUrl(1) . "</td>";
|
||||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||||
|
|
||||||
@ -1871,6 +1939,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
|||||||
print '<td align="right">' . vatrate($tva_tx, true, $line->recuperableonly) . "</td>";
|
print '<td align="right">' . vatrate($tva_tx, true, $line->recuperableonly) . "</td>";
|
||||||
print '<td align="right">' . price($line->price) . "</td>";
|
print '<td align="right">' . price($line->price) . "</td>";
|
||||||
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
||||||
|
|
||||||
|
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '<td align="right">' . price($resultarray[2]) . '</td>';
|
||||||
|
|
||||||
print '<td align="right">' . price($line->price_min) . '</td>';
|
print '<td align="right">' . price($line->price_min) . '</td>';
|
||||||
print '<td align="right">' . price($line->price_min_ttc) . '</td>';
|
print '<td align="right">' . price($line->price_min_ttc) . '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -882,8 +882,6 @@ class Societe extends CommonObject
|
|||||||
$sql .= ', multicurrency_code = \''.$this->db->escape($this->multicurrency_code)."'";
|
$sql .= ', multicurrency_code = \''.$this->db->escape($this->multicurrency_code)."'";
|
||||||
$sql .= " WHERE rowid = '" . $id ."'";
|
$sql .= " WHERE rowid = '" . $id ."'";
|
||||||
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::Update", LOG_DEBUG);
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -982,6 +980,7 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
$result = -2;
|
$result = -2;
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
* \ingroup product
|
* \ingroup product
|
||||||
* \brief Page to show product prices by customer
|
* \brief Page to show product prices by customer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
@ -42,7 +43,8 @@ $langs->load("companies");
|
|||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$search_prod = GETPOST('search_prod');
|
$search_prod = GETPOST('search_prod','alpha');
|
||||||
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int');
|
$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int');
|
||||||
@ -72,7 +74,7 @@ if (empty($reshook))
|
|||||||
$search_prod = '';
|
$search_prod = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
if ($action == 'add_customer_price_confirm' && ! $cancel && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||||
|
|
||||||
$update_child_soc = GETPOST('updatechildprice');
|
$update_child_soc = GETPOST('updatechildprice');
|
||||||
|
|
||||||
@ -82,8 +84,44 @@ if (empty($reshook))
|
|||||||
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
|
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
|
||||||
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
|
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
|
||||||
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
|
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
|
||||||
$prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
|
|
||||||
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
|
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
|
||||||
|
|
||||||
|
// We must define tva_tx, npr and local taxes
|
||||||
|
$vatratecode = '';
|
||||||
|
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
|
||||||
|
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
|
||||||
|
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
|
||||||
|
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
|
||||||
|
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
|
||||||
|
{
|
||||||
|
// We look into database using code (we can't use get_localtax() because it depends on buyer that is not known). Same in update price.
|
||||||
|
$vatratecode=$reg[1];
|
||||||
|
// Get record from code
|
||||||
|
$sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||||
|
$sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'";
|
||||||
|
$sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||||
|
$sql.= " AND t.code ='".$vatratecode."'";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$npr = $obj->recuperableonly;
|
||||||
|
$localtax1 = $obj->localtax1;
|
||||||
|
$localtax2 = $obj->localtax2;
|
||||||
|
$localtax1_type = $obj->localtax1_type;
|
||||||
|
$localtax2_type = $obj->localtax2_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodcustprice->default_vat_code = $vatratecode;
|
||||||
|
$prodcustprice->tva_tx = $tva_tx;
|
||||||
|
$prodcustprice->recuperableonly = $npr;
|
||||||
|
$prodcustprice->localtax1_tx = $localtax1;
|
||||||
|
$prodcustprice->localtax2_tx = $localtax2;
|
||||||
|
$prodcustprice->localtax1_type = $localtax1_type;
|
||||||
|
$prodcustprice->localtax2_type = $localtax2_type;
|
||||||
|
|
||||||
$result = $prodcustprice->create($user, 0, $update_child_soc);
|
$result = $prodcustprice->create($user, 0, $update_child_soc);
|
||||||
|
|
||||||
@ -239,7 +277,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
||||||
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr);
|
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, '', false, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Price base
|
// Price base
|
||||||
@ -374,6 +412,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print '<br></form>';
|
print '<br></form>';
|
||||||
} elseif ($action == 'showlog_customer_price') {
|
} elseif ($action == 'showlog_customer_price') {
|
||||||
|
|
||||||
|
print '<!-- showlog_customer_price -->'."\n";
|
||||||
|
|
||||||
$filter = array (
|
$filter = array (
|
||||||
't.fk_product' => GETPOST('prodid', 'int'),'t.fk_soc' => $socid
|
't.fk_product' => GETPOST('prodid', 'int'),'t.fk_soc' => $socid
|
||||||
);
|
);
|
||||||
@ -483,6 +523,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
|
|
||||||
$option = '&search_prod=' . $search_prod . '&id=' . $object->id;
|
$option = '&search_prod=' . $search_prod . '&id=' . $object->id;
|
||||||
|
|
||||||
|
print '<!-- view specific price for each product -->'."\n";
|
||||||
|
|
||||||
print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVEUR['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, '');
|
print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVEUR['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, '');
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||||
@ -506,8 +548,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
if (count($prodcustprice->lines) > 0 || $search_prod)
|
if (count($prodcustprice->lines) > 0 || $search_prod)
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td><input type="text" class="flat" name="search_prod" value="' . $search_prod . '" size="20"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat" name="search_prod" value="' . $search_prod . '" size="20"></td>';
|
||||||
print '<td colspan="8"> </td>';
|
print '<td class="liste_titre" colspan="8"> </td>';
|
||||||
// Print the search button
|
// Print the search button
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
@ -531,7 +573,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||||
|
|
||||||
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
||||||
print '<td align="right">' . vatrate($line->tva_tx, true, $line->recuperableonly) . "</td>";
|
print '<td align="right">' . vatrate($line->tva_tx.($line->default_vat_code?' ('.$line->default_vat_code.')':''), true, $line->recuperableonly) . "</td>";
|
||||||
print '<td align="right">' . price($line->price) . "</td>";
|
print '<td align="right">' . price($line->price) . "</td>";
|
||||||
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
||||||
print '<td align="right">' . price($line->price_min) . '</td>';
|
print '<td align="right">' . price($line->price_min) . '</td>';
|
||||||
|
|||||||
@ -506,7 +506,7 @@ class SupplierProposal extends CommonObject
|
|||||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la propale meme
|
// Mise a jour informations denormalisees au niveau de la propale meme
|
||||||
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
$result=$this->update_price(1,'auto',0,$this->thirdparty); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
@ -512,32 +512,48 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
// Default trunc (will add ... if truncation truncation or keep last char if only one char)
|
// Default trunc (will add ... if truncation truncation or keep last char if only one char)
|
||||||
$input="éeéeéeàa";
|
$input="éeéeéeàa";
|
||||||
$after=dol_trunc($input,3);
|
$after=dol_trunc($input,3);
|
||||||
$this->assertEquals("éeé...",$after);
|
$this->assertEquals("éeé...",$after,'Test A1');
|
||||||
$after=dol_trunc($input,2);
|
$after=dol_trunc($input,2);
|
||||||
$this->assertEquals("ée...",$after);
|
$this->assertEquals("ée...",$after,'Test A2');
|
||||||
|
$after=dol_trunc($input,1);
|
||||||
|
$this->assertEquals("é...",$after,'Test A3');
|
||||||
|
$input="éeéeé";
|
||||||
|
$after=dol_trunc($input,3);
|
||||||
|
$this->assertEquals("éeéeé",$after,'Test B1');
|
||||||
|
$after=dol_trunc($input,2);
|
||||||
|
$this->assertEquals("éeéeé",$after,'Test B2');
|
||||||
|
$after=dol_trunc($input,1);
|
||||||
|
$this->assertEquals("é...",$after,'Test B3');
|
||||||
|
$input="éeée";
|
||||||
|
$after=dol_trunc($input,3);
|
||||||
|
$this->assertEquals("éeée",$after,'Test C1');
|
||||||
|
$after=dol_trunc($input,2);
|
||||||
|
$this->assertEquals("éeée",$after,'Test C2');
|
||||||
|
$after=dol_trunc($input,1);
|
||||||
|
$this->assertEquals("éeée",$after,'Test C3');
|
||||||
$input="éeé";
|
$input="éeé";
|
||||||
$after=dol_trunc($input,3);
|
$after=dol_trunc($input,3);
|
||||||
$this->assertEquals("éeé",$after);
|
$this->assertEquals("éeé",$after,'Test C');
|
||||||
$after=dol_trunc($input,2);
|
$after=dol_trunc($input,2);
|
||||||
$this->assertEquals("éeé",$after);
|
$this->assertEquals("éeé",$after,'Test D');
|
||||||
$after=dol_trunc($input,1);
|
$after=dol_trunc($input,1);
|
||||||
$this->assertEquals("é...",$after);
|
$this->assertEquals("éeé",$after,'Test E');
|
||||||
// Trunc with no ...
|
// Trunc with no ...
|
||||||
$input="éeéeéeàa";
|
$input="éeéeéeàa";
|
||||||
$after=dol_trunc($input,3,'right','UTF-8',1);
|
$after=dol_trunc($input,3,'right','UTF-8',1);
|
||||||
$this->assertEquals("éeé",$after);
|
$this->assertEquals("éeé",$after,'Test F');
|
||||||
$after=dol_trunc($input,2,'right','UTF-8',1);
|
$after=dol_trunc($input,2,'right','UTF-8',1);
|
||||||
$this->assertEquals("ée",$after);
|
$this->assertEquals("ée",$after,'Test G');
|
||||||
$input="éeé";
|
$input="éeé";
|
||||||
$after=dol_trunc($input,3,'right','UTF-8',1);
|
$after=dol_trunc($input,3,'right','UTF-8',1);
|
||||||
$this->assertEquals("éeé",$after);
|
$this->assertEquals("éeé",$after,'Test H');
|
||||||
$after=dol_trunc($input,2,'right','UTF-8',1);
|
$after=dol_trunc($input,2,'right','UTF-8',1);
|
||||||
$this->assertEquals("ée",$after);
|
$this->assertEquals("ée",$after,'Test I');
|
||||||
$after=dol_trunc($input,1,'right','UTF-8',1);
|
$after=dol_trunc($input,1,'right','UTF-8',1);
|
||||||
$this->assertEquals("é",$after);
|
$this->assertEquals("é",$after,'Test J');
|
||||||
$input="éeéeéeàa";
|
$input="éeéeéeàa";
|
||||||
$after=dol_trunc($input,4,'middle');
|
$after=dol_trunc($input,4,'middle');
|
||||||
$this->assertEquals("ée...àa",$after);
|
$this->assertEquals("ée...àa",$after,'Test K');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user