Skip to content

Commit

Permalink
Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/includes/tecnickcom/tcpdf/tcpdf.php
  • Loading branch information
eldy committed Feb 3, 2020
2 parents 8957a29 + 2cb414e commit 97d7267
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
8 changes: 8 additions & 0 deletions htdocs/bom/bom_card.php
Expand Up @@ -155,6 +155,8 @@

if (!$error)
{
$lastposition = 0;

$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
Expand All @@ -163,6 +165,12 @@
$bomline->disable_stock_change = (int) $disable_stock_change;
$bomline->efficiency = $efficiency;

// Rang to use
$rangmax = $object->line_max(0);
$ranktouse = $rangmax + 1;

$bomline->position = ($ranktouse + 1);

$result = $bomline->create($user);
if ($result <= 0)
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/CMailFile.class.php
Expand Up @@ -508,7 +508,7 @@ public function sendfile()

$res = false;

if (empty($conf->global->MAIN_DISABLE_ALL_MAILS) || !empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db);
Expand Down
7 changes: 5 additions & 2 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -2744,10 +2744,13 @@ public function getIdOfLine($rang)
public function line_max($fk_parent_line = 0)
{
// phpcs:enable
$positionfield = 'rang';
if ($this->table_element == 'bom') $positionfield = 'position';

// Search the last rang with fk_parent_line
if ($fk_parent_line)
{
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql = 'SELECT max('.$positionfield.') FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql .= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql .= ' AND fk_parent_line = '.$fk_parent_line;

Expand All @@ -2769,7 +2772,7 @@ public function line_max($fk_parent_line = 0)
// If not, search the last rang of element
else
{
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql = 'SELECT max('.$positionfield.') FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql .= ' WHERE '.$this->fk_element.' = '.$this->id;

dol_syslog(get_class($this)."::line_max", LOG_DEBUG);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/includes/tecnickcom/tcpdf/tcpdf.php
Expand Up @@ -6880,7 +6880,7 @@ public function Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $alig
if (!@TCPDF_STATIC::file_exists($file)) {
// DOL CHANGE If we keep this, the image is not visible on pages after the first one.
//var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file)));
//return false;
//return false;
}
if (($imsize = @getimagesize($file)) === FALSE) {
if (in_array($file, $this->imagekeys)) {
Expand Down

0 comments on commit 97d7267

Please sign in to comment.