This commit is contained in:
Maxime Kohlhaas 2017-07-27 10:05:00 +02:00
commit e1dd85d261
15 changed files with 335 additions and 224 deletions

View File

@ -353,8 +353,10 @@ begin
begin begin
// TODO Copy file or ask to install package ? // TODO Copy file or ask to install package ?
//CustomMessage('YouWillInstallDoliWamp')+#13#13 //CustomMessage('YouWillInstallDoliWamp')+#13#13
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://ccc">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK); MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30679">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
end; end;
// Pb seems similar with msvcp110.dll
//vcredist_x64.exe
// If we have a new database version, we should only copy old my.ini file into new directory // If we have a new database version, we should only copy old my.ini file into new directory

View File

@ -830,7 +830,7 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();

View File

@ -2973,6 +2973,7 @@ else if ($id > 0 || ! empty($ref))
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherBills").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {

View File

@ -621,7 +621,7 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();

View File

@ -382,7 +382,7 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }

View File

@ -331,7 +331,7 @@ if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights-
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }

View File

@ -323,6 +323,7 @@ function dol_dir_is_emtpy($folder)
* *
* @param string $file Filename * @param string $file Filename
* @return int <0 if KO, Number of lines in files if OK * @return int <0 if KO, Number of lines in files if OK
* @see dol_nboflines
*/ */
function dol_count_nb_of_line($file) function dol_count_nb_of_line($file)
{ {

View File

@ -2325,7 +2325,7 @@ function img_picto($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $
if ($pictoisfullpath) if ($pictoisfullpath)
{ {
// Clean parameters // Clean parameters
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png'; if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png';
$fullpathpicto = $picto; $fullpathpicto = $picto;
} }
else else
@ -2346,7 +2346,7 @@ function img_picto($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $
$path = $regs[2]; // $path is $mymodule $path = $regs[2]; // $path is $mymodule
} }
// Clean parameters // Clean parameters
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png'; if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png';
// If alt path are defined, define url where img file is, according to physical path // If alt path are defined, define url where img file is, according to physical path
foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...) foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...)
{ {
@ -4488,10 +4488,13 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
* Return first line of text. Cut will depends if content is HTML or not. * Return first line of text. Cut will depends if content is HTML or not.
* *
* @param string $text Input text * @param string $text Input text
* @param int $nboflines Nb of lines to get (default is 1 = first line only)
* @return string Output text * @return string Output text
* @see dol_nboflines_bis, dol_string_nohtmltag, dol_escape_htmltag * @see dol_nboflines_bis, dol_string_nohtmltag, dol_escape_htmltag
*/ */
function dolGetFirstLineOfText($text) function dolGetFirstLineOfText($text, $nboflines=1)
{
if ($nboflines == 1)
{ {
if (dol_textishtml($text)) if (dol_textishtml($text))
{ {
@ -4505,6 +4508,38 @@ function dolGetFirstLineOfText($text)
} }
return $firstline.((strlen($firstline) != strlen($text))?'...':''); return $firstline.((strlen($firstline) != strlen($text))?'...':'');
} }
else
{
$ishtml=0;
if (dol_textishtml($text))
{
$text=preg_replace('/\n/','',$text);
$ishtml=1;
$repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " ");
}
else
{
$repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " ");
}
$text = strtr($text, $repTable);
if ($charset == 'UTF-8') { $pattern = '/(<br[^>]*>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
else $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
$a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$firstline='';
$i=0;
$nba = count($a); // 2x nb of lines in $a because $a contains also a line for each new line separator
while (($i < $nba) && ($i < ($nboflines * 2)))
{
if ($i % 2 == 0) $firstline .= $a[$i];
elseif (($i < (($nboflines * 2) - 1)) && ($i < ($nba - 1))) $firstline .= ($ishtml?"<br>\n":"\n");
$i++;
}
unset($a);
return $firstline.(($i < $nba)?'...':'');
}
}
/** /**
@ -4665,7 +4700,7 @@ function dol_nboflines($s,$maxchar=0)
/** /**
* Return nb of lines of a formated text with \n and <br> (we can't have both \n and br) * Return nb of lines of a formated text with \n and <br> (WARNING: string must not have mixed \n and br separators)
* *
* @param string $text Text * @param string $text Text
* @param int $maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut) * @param int $maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut)
@ -4701,6 +4736,8 @@ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
} }
} }
} }
unset($a);
return $nblines; return $nblines;
} }

View File

@ -1290,10 +1290,10 @@ class DolibarrModules // Can not be abstract, because we need to insta
$sql.= " VALUES ("; $sql.= " VALUES (";
$sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1); $sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1);
$sql.= ", 'chaine'"; $sql.= ", 'chaine'";
$sql.= ", ".$this->db->encrypt($value,1); $sql.= ", ".$this->db->encrypt($newvalue,1);
$sql.= ", null"; $sql.= ", null";
$sql.= ", '0'"; $sql.= ", '0'";
$sql.= ", ".$conf->entity; $sql.= ", ".$entity;
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG); dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);

View File

@ -475,7 +475,7 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();

View File

@ -471,7 +471,7 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();

View File

@ -611,3 +611,7 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (14
-- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT; -- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT;
ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50); ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50);
-- Negative buying prices
UPDATE llx_facturedet SET buy_price_ht = ABS(buy_price_ht)

View File

@ -67,6 +67,7 @@ NoPredefinedProductToDispatch=No predefined products for this object. So no disp
DispatchVerb=Dispatch DispatchVerb=Dispatch
StockLimitShort=Limit for alert StockLimitShort=Limit for alert
StockLimit=Stock limit for alert StockLimit=Stock limit for alert
StockLimitDesc="" (empty) default value means no alert. <br>"0" can be used with 'Stock can be negative' configuration.
PhysicalStock=Physical stock PhysicalStock=Physical stock
RealStock=Real Stock RealStock=Real Stock
RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements. RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements.

View File

@ -120,10 +120,75 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
/**
* testDolGetFirstLineOfText
*
* @return void
*/
public function testDolGetFirstLineOfText()
{
// Nb of line is same than entry text
$input="aaaa";
$result=dolGetFirstLineOfText($input);
print __METHOD__." result=".$result."\n";
$this->assertEquals("aaaa", $result);
$input="aaaa\nbbbbbbbbbbbb\n";
$result=dolGetFirstLineOfText($input, 2);
print __METHOD__." result=".$result."\n";
$this->assertEquals("aaaa\nbbbbbbbbbbbb", $result);
$input="aaaa<br>bbbbbbbbbbbb<br>";
$result=dolGetFirstLineOfText($input, 2);
print __METHOD__." result=".$result."\n";
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb", $result);
// Nb of line is lower
$input="aaaa\nbbbbbbbbbbbb\ncccccc\n";
$result=dolGetFirstLineOfText($input);
print __METHOD__." result=".$result."\n";
$this->assertEquals("aaaa...", $result);
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
$result=dolGetFirstLineOfText($input);
print __METHOD__." result=".$result."\n";
$this->assertEquals("aaaa...", $result);
$input="aaaa\nbbbbbbbbbbbb\ncccccc\n";
$result=dolGetFirstLineOfText($input, 2);
print __METHOD__." result=".$result."\n";
$this->assertEquals("aaaa\nbbbbbbbbbbbb...", $result);
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
$result=dolGetFirstLineOfText($input, 2);
print __METHOD__." result=".$result."\n";
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb...", $result);
// Nb of line is higher
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc";
$result=dolGetFirstLineOfText($input, 100);
print __METHOD__." result=".$result."\n";
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 a');
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
$result=dolGetFirstLineOfText($input, 100);
print __METHOD__." result=".$result."\n";
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 b');
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>\n";
$result=dolGetFirstLineOfText($input, 100);
print __METHOD__." result=".$result."\n";
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 c');
}
/** /**
* testDolBuildPath * testDolBuildPath
* *
* @return boolean * @return void
*/ */
public function testDolBuildPath() public function testDolBuildPath()
{ {