Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2020-10-29 13:10:50 +01:00
commit 45477aba0d
16 changed files with 4833 additions and 4833 deletions

View File

@ -54,113 +54,113 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask')
{
$maskconstdelivery = GETPOST('maskconstdelivery', 'alpha');
$maskdelivery = GETPOST('maskdelivery', 'alpha');
if ($maskconstdelivery) $res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity);
$maskconstdelivery = GETPOST('maskconstdelivery', 'alpha');
$maskdelivery = GETPOST('maskdelivery', 'alpha');
if ($maskconstdelivery) $res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
if ($action == 'set_DELIVERY_FREE_TEXT')
{
$free = GETPOST('DELIVERY_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity);
$free = GETPOST('DELIVERY_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
if ($action == 'specimen')
{
$modele = GETPOST('module', 'alpha');
$modele = GETPOST('module', 'alpha');
$sending = new Delivery($db);
$sending->initAsSpecimen();
$sending = new Delivery($db);
$sending->initAsSpecimen();
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/delivery/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/delivery/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
if ($filefound)
{
require_once $file;
$module = new $classname($db);
$module = new $classname($db);
if ($module->write_file($sending, $langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=delivery&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
if ($module->write_file($sending, $langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=delivery&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
if ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
$ret = addDocumentModel($value, $type, $label, $scandir);
}
if ($action == 'del')
{
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->DELIVERY_ADDON_PDF == "$value") dolibarr_del_const($db, 'DELIVERY_ADDON_PDF', $conf->entity);
}
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->DELIVERY_ADDON_PDF == "$value") dolibarr_del_const($db, 'DELIVERY_ADDON_PDF', $conf->entity);
}
}
if ($action == 'setdoc')
{
if (dolibarr_set_const($db, "DELIVERY_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
{
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->DELIVERY_ADDON_PDF = $value;
}
if (dolibarr_set_const($db, "DELIVERY_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
{
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->DELIVERY_ADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
if ($action == 'setmod')
{
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
dolibarr_set_const($db, "DELIVERY_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "DELIVERY_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity);
}
@ -199,79 +199,79 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/delivery/");
$dir = dol_buildpath($reldir."core/modules/delivery/");
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if (preg_match('/^mod_delivery_([a-z0-9_]*)\.php$/', $file)) {
$file = substr($file, 0, dol_strlen($file) - 4);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if (preg_match('/^mod_delivery_([a-z0-9_]*)\.php$/', $file)) {
$file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.$file.'.php';
require_once $dir.$file.'.php';
$module = new $file;
$module = new $file;
if ($module->isEnabled())
{
{
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print '</td>';
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print '</td>';
// Show example of numbering module
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
// Show example of numbering module
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->DELIVERY_ADDON_NUMBER == "$file")
{
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;token='.newToken().'&amp;value='.urlencode($file).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
}
print '</td>';
print '<td class="center">';
if ($conf->global->DELIVERY_ADDON_NUMBER == "$file")
{
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;token='.newToken().'&amp;value='.urlencode($file).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
}
print '</td>';
$delivery = new Delivery($db);
$delivery->initAsSpecimen();
$delivery = new Delivery($db);
$delivery->initAsSpecimen();
// Info
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mysoc, $delivery);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
// Info
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mysoc, $delivery);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '</tr>';
}
}
}
closedir($handle);
}
}
print '</tr>';
}
}
}
closedir($handle);
}
}
}
print '</table>';
@ -321,14 +321,14 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/delivery/doc/");
$dir = dol_buildpath($reldir."core/modules/delivery/doc/");
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
@ -337,79 +337,79 @@ foreach ($dirmodels as $reldir)
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print "</td>";
} else {
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print "</td>";
} else {
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print "<td align=\"center\">";
if ($conf->global->DELIVERY_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Default
print "<td align=\"center\">";
if ($conf->global->DELIVERY_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").'</u>:';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").'</u>:';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'sending').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'sending').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print '</tr>';
}
}
}
}
}
}
print '</tr>';
}
}
}
}
}
}
}
print '</table>';
@ -440,11 +440,11 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnDeliveryReceipts"), $la
$variablename = 'DELIVERY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';

View File

@ -124,9 +124,9 @@ class Propal extends CommonObject
*/
public $datec;
/**
* @var integer|string $date_creation;
*/
/**
* @var integer|string $date_creation;
*/
public $date_creation;
/**
@ -136,13 +136,13 @@ class Propal extends CommonObject
public $datev;
/**
* @var integer|string $date_validation;
*/
* @var integer|string $date_validation;
*/
public $date_validation;
/**
* @var integer|string date of the quote;
*/
* @var integer|string date of the quote;
*/
public $date;
/**
@ -186,9 +186,9 @@ class Propal extends CommonObject
public $remise_absolue = 0;
/**
* @var int ID
* @deprecated
*/
* @var int ID
* @deprecated
*/
public $fk_address;
public $address_type;
@ -218,8 +218,8 @@ class Propal extends CommonObject
// Multicurrency
/**
* @var int ID
*/
* @var int ID
*/
public $fk_multicurrency;
public $multicurrency_code;
@ -342,7 +342,7 @@ class Propal extends CommonObject
* @param int $socid Id third party
* @param int $propalid Id proposal
*/
public function __construct($db, $socid = 0, $propalid = 0)
public function __construct($db, $socid = 0, $propalid = 0)
{
global $conf, $langs;
@ -357,7 +357,7 @@ class Propal extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add line into array products
* $this->thirdparty should be loaded
@ -370,9 +370,9 @@ class Propal extends CommonObject
* TODO Replace calls to this function by generation objet Ligne
* inserted into table $this->products
*/
public function add_product($idproduct, $qty, $remise_percent = 0)
public function add_product($idproduct, $qty, $remise_percent = 0)
{
// phpcs:enable
// phpcs:enable
global $conf, $mysoc;
if (!$qty) $qty = 1;
@ -417,16 +417,16 @@ class Propal extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adding line of fixed discount in the proposal in DB
*
* @param int $idremise Id of fixed discount
* @return int >0 if OK, <0 if KO
*/
public function insert_discount($idremise)
public function insert_discount($idremise)
{
// phpcs:enable
// phpcs:enable
global $langs;
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -493,43 +493,43 @@ class Propal extends CommonObject
}
}
/**
* Add a proposal line into database (linked to product/service or not)
* The parameters are already supposed to be appropriate and with final values to the call
* of this method. Also, for the VAT rate, it must have already been defined
* by whose calling the method get_default_tva (societe_vendeuse, societe_acheteuse, '' product)
* and desc must already have the right value (it's up to the caller to manage multilanguage)
*
* @param string $desc Description of line
* @param float $pu_ht Unit price
* @param float $qty Quantity
* @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
* @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
* @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
* @param int $fk_product Product/Service ID predefined
* @param float $remise_percent Pourcentage de remise de la ligne
* @param string $price_base_type HT or TTC
* @param float $pu_ttc Prix unitaire TTC
* @param int $info_bits Bits for type of lines
* @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used.
* @param int $rang Position of line
* @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Id of parent line
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price without tax
* @param string $label ???
* @param int $date_start Start date of the line
* @param int $date_end End date of the line
* @param array $array_options extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
* @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id
* @param double $pu_ht_devise Unit price in currency
* @param int $fk_remise_except Id discount if line is from a discount
* @return int >0 if OK, <0 if KO
* @see add_product()
*/
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0)
/**
* Add a proposal line into database (linked to product/service or not)
* The parameters are already supposed to be appropriate and with final values to the call
* of this method. Also, for the VAT rate, it must have already been defined
* by whose calling the method get_default_tva (societe_vendeuse, societe_acheteuse, '' product)
* and desc must already have the right value (it's up to the caller to manage multilanguage)
*
* @param string $desc Description of line
* @param float $pu_ht Unit price
* @param float $qty Quantity
* @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
* @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
* @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
* @param int $fk_product Product/Service ID predefined
* @param float $remise_percent Pourcentage de remise de la ligne
* @param string $price_base_type HT or TTC
* @param float $pu_ttc Prix unitaire TTC
* @param int $info_bits Bits for type of lines
* @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used.
* @param int $rang Position of line
* @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Id of parent line
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price without tax
* @param string $label ???
* @param int $date_start Start date of the line
* @param int $date_end End date of the line
* @param array $array_options extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
* @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id
* @param double $pu_ht_devise Unit price in currency
* @param int $fk_remise_except Id discount if line is from a discount
* @return int >0 if OK, <0 if KO
* @see add_product()
*/
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0)
{
global $mysoc, $conf, $langs;
@ -706,27 +706,27 @@ class Propal extends CommonObject
// Reorder if child line
if (!empty($fk_parent_line)) $this->line_order(true, 'DESC');
// Mise a jour informations denormalisees au niveau de la propale meme
$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)
{
$this->db->commit();
return $this->line->id;
} else {
$this->error = $this->db->error();
$this->db->rollback();
return -1;
}
} else {
$this->error = $this->line->error;
$this->db->rollback();
return -2;
}
} else {
// Mise a jour informations denormalisees au niveau de la propale meme
$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)
{
$this->db->commit();
return $this->line->id;
} else {
$this->error = $this->db->error();
$this->db->rollback();
return -1;
}
} else {
$this->error = $this->line->error;
$this->db->rollback();
return -2;
}
} else {
dol_syslog(get_class($this)."::addline status of proposal must be Draft to allow use of ->addline()", LOG_ERR);
return -3;
}
}
}
/**
@ -757,11 +757,11 @@ class Propal extends CommonObject
* @param int $notrigger disable line update trigger
* @return int 0 if OK, <0 if KO
*/
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
{
global $mysoc, $langs;
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -778,11 +778,11 @@ class Propal extends CommonObject
if (!empty($qty) && $special_code == 3) $special_code = 0; // Remove option tag
if (empty($type)) $type = 0;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error = $langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error = $langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
if ($this->statut == self::STATUS_DRAFT)
{
@ -926,7 +926,7 @@ class Propal extends CommonObject
* @param int $lineid Id of line to delete
* @return int >0 if OK, <0 if KO
*/
public function deleteline($lineid)
public function deleteline($lineid)
{
global $user;
@ -964,7 +964,7 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >=0 if OK
*/
public function create($user, $notrigger = 0)
public function create($user, $notrigger = 0)
{
global $conf, $hookmanager;
$error = 0;
@ -1102,62 +1102,62 @@ class Propal extends CommonObject
$resql = $this->db->query($sql);
if (!$resql) $error++;
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
{
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
}
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
{
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
}
// Add object linked
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
{
foreach ($this->linked_objects as $origin => $tmp_origin_id)
{
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
{
foreach ($tmp_origin_id as $origin_id)
{
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret)
{
$this->error = $this->db->lasterror();
$error++;
}
}
} else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
{
$origin_id = $tmp_origin_id;
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret)
{
$this->error = $this->db->lasterror();
$error++;
}
}
}
}
// Add object linked
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
{
foreach ($this->linked_objects as $origin => $tmp_origin_id)
{
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
{
foreach ($tmp_origin_id as $origin_id)
{
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret)
{
$this->error = $this->db->lasterror();
$error++;
}
}
} else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
{
$origin_id = $tmp_origin_id;
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret)
{
$this->error = $this->db->lasterror();
$error++;
}
}
}
}
/*
/*
* Insertion du detail des produits dans la base
* Insert products detail in database
*/
if (!$error)
{
$fk_parent_line = 0;
$num = count($this->lines);
if (!$error)
{
$fk_parent_line = 0;
$num = count($this->lines);
for ($i = 0; $i < $num; $i++)
{
if (!is_object($this->lines[$i])) // If this->lines is not array of objects, coming from REST API
{ // Convert into object this->lines[$i].
$line = (object) $this->lines[$i];
} else {
$line = $this->lines[$i];
}
if (!is_object($this->lines[$i])) // If this->lines is not array of objects, coming from REST API
{ // Convert into object this->lines[$i].
$line = (object) $this->lines[$i];
} else {
$line = $this->lines[$i];
}
// Reset fk_parent_line for line that are not child lines or special product
if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
$fk_parent_line = 0;
}
// Complete vat rate with code
// Complete vat rate with code
$vatrate = $line->tva_tx;
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
@ -1273,7 +1273,7 @@ class Propal extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Insert into DB a proposal object completely defined by its data members (ex, results from copy).
*
@ -1281,9 +1281,9 @@ class Propal extends CommonObject
* @return int Id of the new object if ok, <0 if ko
* @see create()
*/
public function create_from($user)
public function create_from($user)
{
// phpcs:enable
// phpcs:enable
// i love this function because $this->products is not used in create function...
$this->products = $this->lines;
@ -1324,10 +1324,10 @@ class Propal extends CommonObject
{
if ($objsoc->fetch($socid) > 0)
{
$object->socid = $objsoc->id;
$object->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$object->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$object->fk_delivery_address = '';
$object->socid = $objsoc->id;
$object->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$object->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$object->fk_delivery_address = '';
/*if (!empty($conf->projet->enabled))
{
@ -1339,7 +1339,7 @@ class Propal extends CommonObject
$clonedObj->fk_project = '';
}
}*/
$object->fk_project = ''; // A cloned proposal is set by default to no project.
$object->fk_project = ''; // A cloned proposal is set by default to no project.
}
// reset ref_client
@ -1347,7 +1347,7 @@ class Propal extends CommonObject
// TODO Change product price if multi-prices
} else {
$objsoc->fetch($object->socid);
$objsoc->fetch($object->socid);
}
$object->id = 0;
@ -1372,18 +1372,18 @@ class Propal extends CommonObject
$result = $object->create($user);
if ($result < 0)
{
$this->error = $object->error;
$this->errors = array_merge($this->errors, $object->errors);
$error++;
$this->error = $object->error;
$this->errors = array_merge($this->errors, $object->errors);
$error++;
}
if (!$error)
{
// copy internal contacts
if ($object->copy_linked_contact($this, 'internal') < 0)
{
if ($object->copy_linked_contact($this, 'internal') < 0)
{
$error++;
}
}
}
if (!$error)
@ -1391,7 +1391,7 @@ class Propal extends CommonObject
// copy external contacts if same company
if ($this->socid == $object->socid)
{
if ($object->copy_linked_contact($this, 'external') < 0)
if ($object->copy_linked_contact($this, 'external') < 0)
$error++;
}
}
@ -1429,7 +1429,7 @@ class Propal extends CommonObject
* @param string $ref_ext Ref ext of proposal
* @return int >0 if OK, <0 if KO
*/
public function fetch($rowid, $ref = '', $ref_ext = '')
public function fetch($rowid, $ref = '', $ref_ext = '')
{
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
@ -1595,7 +1595,7 @@ class Propal extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
public function update(User $user, $notrigger = 0)
public function update(User $user, $notrigger = 0)
{
global $conf;
@ -1684,7 +1684,7 @@ class Propal extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load array lines
*
@ -1696,7 +1696,7 @@ class Propal extends CommonObject
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
{
global $langs, $conf;
// phpcs:enable
// phpcs:enable
$this->lines = array();
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
@ -1790,11 +1790,11 @@ class Propal extends CommonObject
$line->fetch_optionals();
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
$line = new Product($this->db);
$line->fetch($objp->fk_product);
$line->getMultiLangs();
}
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
$line = new Product($this->db);
$line->fetch($objp->fk_product);
$line->getMultiLangs();
}
$this->lines[$i] = $line;
//dol_syslog("1 ".$line->fk_product);
@ -1818,7 +1818,7 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0=execute triggers
* @return int <0 if KO, 0=Nothing done, >=0 if OK
*/
public function valid($user, $notrigger = 0)
public function valid($user, $notrigger = 0)
{
global $conf;
@ -1933,7 +1933,7 @@ class Propal extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define proposal date
*
@ -1942,9 +1942,9 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
public function set_date($user, $date, $notrigger = 0)
public function set_date($user, $date, $notrigger = 0)
{
// phpcs:enable
// phpcs:enable
if (empty($date))
{
$this->error = 'ErrorBadParameter';
@ -2000,7 +2000,7 @@ class Propal extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define end validity date
*
@ -2009,9 +2009,9 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
public function set_echeance($user, $date_fin_validite, $notrigger = 0)
public function set_echeance($user, $date_fin_validite, $notrigger = 0)
{
// phpcs:enable
// phpcs:enable
if (!empty($user->rights->propal->creer))
{
$error = 0;
@ -2134,7 +2134,7 @@ class Propal extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set delivery
*
@ -2201,7 +2201,7 @@ class Propal extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set source of demand
*
@ -2270,7 +2270,7 @@ class Propal extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set customer reference number
*
@ -2331,7 +2331,7 @@ class Propal extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set an overall discount on the proposal
*
@ -2396,7 +2396,7 @@ class Propal extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set an absolute overall discount on the proposal
*
@ -2676,7 +2676,7 @@ class Propal extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set draft status
*
@ -2825,7 +2825,7 @@ class Propal extends CommonObject
return $this->InvoiceArrayList($this->id);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns an array with id and ref of related invoices
*
@ -3091,7 +3091,7 @@ class Propal extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Change source demand
*
@ -3446,7 +3446,7 @@ class Propal extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge indicateurs this->nb de tableau de bord
*
@ -4260,7 +4260,7 @@ class PropaleLigne extends CommonObjectLine
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update DB line fields total_xxx
* Used by migration

View File

@ -242,7 +242,7 @@ if (empty($reshook))
{
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
$selectedLines = GETPOST('toselect', 'array');
$selectedLines = GETPOST('toselect', 'array');
if ($datecommande == '') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), null, 'errors');
@ -349,7 +349,7 @@ if (empty($reshook))
for ($i = 0; $i < $num; $i++)
{
if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
$label = (!empty($lines[$i]->label) ? $lines[$i]->label : '');
$desc = (!empty($lines[$i]->desc) ? $lines[$i]->desc : '');
@ -738,8 +738,8 @@ if (empty($reshook))
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
{
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level];
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level];
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
}
}
// If price per customer
@ -1284,82 +1284,82 @@ if (empty($reshook))
// add lines from objectlinked
if ($action == 'import_lines_from_object'
&& $usercancreate
&& $object->statut == Commande::STATUS_DRAFT
&& $usercancreate
&& $object->statut == Commande::STATUS_DRAFT
)
{
$fromElement = GETPOST('fromelement');
$fromElementid = GETPOST('fromelementid');
$importLines = GETPOST('line_checkbox');
$fromElement = GETPOST('fromelement');
$fromElementid = GETPOST('fromelementid');
$importLines = GETPOST('line_checkbox');
if (!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
{
if ($fromElement == 'commande')
{
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'OrderLine';
} elseif ($fromElement == 'propal')
{
dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'PropaleLigne';
}
$nextRang = count($object->lines) + 1;
$importCount = 0;
$error = 0;
foreach ($importLines as $lineId)
{
$lineId = intval($lineId);
$originLine = new $lineClassName($db);
if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0)
{
$originLine->fetch_optionals();
$desc = $originLine->desc;
$pu_ht = $originLine->subprice;
$qty = $originLine->qty;
$txtva = $originLine->tva_tx;
$txlocaltax1 = $originLine->localtax1_tx;
$txlocaltax2 = $originLine->localtax2_tx;
$fk_product = $originLine->fk_product;
$remise_percent = $originLine->remise_percent;
$date_start = $originLine->date_start;
$date_end = $originLine->date_end;
$ventil = 0;
$info_bits = $originLine->info_bits;
$fk_remise_except = $originLine->fk_remise_except;
$price_base_type = 'HT';
$pu_ttc = 0;
$type = $originLine->product_type;
$rang = $nextRang++;
$special_code = $originLine->special_code;
$origin = $originLine->element;
$origin_id = $originLine->id;
$fk_parent_line = 0;
$fk_fournprice = $originLine->fk_fournprice;
$pa_ht = $originLine->pa_ht;
$label = $originLine->label;
$array_options = $originLine->array_options;
$situation_percent = 100;
$fk_prev_id = '';
$fk_unit = $originLine->fk_unit;
$pu_ht_devise = $originLine->multicurrency_subprice;
if (!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
{
if ($fromElement == 'commande')
{
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'OrderLine';
} elseif ($fromElement == 'propal')
{
dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'PropaleLigne';
}
$nextRang = count($object->lines) + 1;
$importCount = 0;
$error = 0;
foreach ($importLines as $lineId)
{
$lineId = intval($lineId);
$originLine = new $lineClassName($db);
if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0)
{
$originLine->fetch_optionals();
$desc = $originLine->desc;
$pu_ht = $originLine->subprice;
$qty = $originLine->qty;
$txtva = $originLine->tva_tx;
$txlocaltax1 = $originLine->localtax1_tx;
$txlocaltax2 = $originLine->localtax2_tx;
$fk_product = $originLine->fk_product;
$remise_percent = $originLine->remise_percent;
$date_start = $originLine->date_start;
$date_end = $originLine->date_end;
$ventil = 0;
$info_bits = $originLine->info_bits;
$fk_remise_except = $originLine->fk_remise_except;
$price_base_type = 'HT';
$pu_ttc = 0;
$type = $originLine->product_type;
$rang = $nextRang++;
$special_code = $originLine->special_code;
$origin = $originLine->element;
$origin_id = $originLine->id;
$fk_parent_line = 0;
$fk_fournprice = $originLine->fk_fournprice;
$pa_ht = $originLine->pa_ht;
$label = $originLine->label;
$array_options = $originLine->array_options;
$situation_percent = 100;
$fk_prev_id = '';
$fk_unit = $originLine->fk_unit;
$pu_ht_devise = $originLine->multicurrency_subprice;
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $date_start, $date_end, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise);
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $date_start, $date_end, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise);
if ($res > 0) {
$importCount++;
} else {
$error++;
}
} else {
$error++;
}
}
if ($res > 0) {
$importCount++;
} else {
$error++;
}
} else {
$error++;
}
}
if ($error)
{
setEventMessages($langs->trans('ErrorsOnXLines', $error), null, 'errors');
}
}
if ($error)
{
setEventMessages($langs->trans('ErrorsOnXLines', $error), null, 'errors');
}
}
}
// Actions when printing a doc from card
@ -1849,7 +1849,7 @@ if ($action == 'create' && $usercancreate)
print '</table>';
}
print '</form>';
print '</form>';
} else {
// Mode view
$now = dol_now();
@ -2635,9 +2635,9 @@ if ($action == 'create' && $usercancreate)
$compatibleImportElementsList = false;
if ($usercancreate
&& $object->statut == Commande::STATUS_DRAFT)
&& $object->statut == Commande::STATUS_DRAFT)
{
$compatibleImportElementsList = array('commande', 'propal'); // import from linked elements
$compatibleImportElementsList = array('commande', 'propal'); // import from linked elements
}
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);

View File

@ -31,166 +31,166 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
class box_supplier_orders_awaiting_reception extends ModeleBoxes
{
public $boxcode = "supplierordersawaitingreception";
public $boximg = "object_order";
public $boxlabel = "BoxLatestSupplierOrdersAwaitingReception";
public $depends = array("fournisseur");
public $boxcode = "supplierordersawaitingreception";
public $boximg = "object_order";
public $boxlabel = "BoxLatestSupplierOrdersAwaitingReception";
public $depends = array("fournisseur");
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $info_box_head = array();
public $info_box_contents = array();
public $param;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param)
{
global $user;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param)
{
global $user;
$this->db = $db;
$this->db = $db;
$this->hidden = !($user->rights->fournisseur->commande->lire);
}
$this->hidden = !($user->rights->fournisseur->commande->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $conf, $user, $langs;
$langs->loadLangs(array("boxes", "sendings", "orders"));
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $conf, $user, $langs;
$langs->loadLangs(array("boxes", "sendings", "orders"));
$this->max = $max;
$this->max = $max;
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$supplierorderstatic = new CommandeFournisseur($this->db);
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$thirdpartytmp = new Fournisseur($this->db);
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$supplierorderstatic = new CommandeFournisseur($this->db);
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$thirdpartytmp = new Fournisseur($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleSupplierOrdersAwaitingReception", $max));
$this->info_box_head = array('text' => $langs->trans("BoxTitleSupplierOrdersAwaitingReception", $max));
if ($user->rights->fournisseur->commande->lire)
{
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql .= " s.code_client, s.code_fournisseur, s.email,";
$sql .= " s.logo,";
$sql .= " c.rowid, c.ref, c.tms, c.date_commande, c.date_livraison, ";
$sql .= " c.total_ht,";
$sql .= " c.tva as total_tva,";
$sql .= " c.total_ttc,";
$sql .= " c.fk_statut";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
$sql .= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
else $sql .= " ORDER BY c.date_livraison ASC, c.fk_statut ASC ";
$sql .= $this->db->plimit($max, 0);
if ($user->rights->fournisseur->commande->lire)
{
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql .= " s.code_client, s.code_fournisseur, s.email,";
$sql .= " s.logo,";
$sql .= " c.rowid, c.ref, c.tms, c.date_commande, c.date_livraison, ";
$sql .= " c.total_ht,";
$sql .= " c.tva as total_tva,";
$sql .= " c.total_ttc,";
$sql .= " c.fk_statut";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
$sql .= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
else $sql .= " ORDER BY c.date_livraison ASC, c.fk_statut ASC ";
$sql .= $this->db->plimit($max, 0);
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$line = 0;
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$date = $this->db->jdate($objp->date_commande);
$delivery_date = $this->db->jdate($objp->date_livraison);
$line = 0;
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$date = $this->db->jdate($objp->date_commande);
$delivery_date = $this->db->jdate($objp->date_livraison);
$datem = $this->db->jdate($objp->tms);
$supplierorderstatic->date_livraison = $delivery_date;
$supplierorderstatic->statut = $objp->fk_statut;
$supplierorderstatic->date_livraison = $delivery_date;
$supplierorderstatic->statut = $objp->fk_statut;
$supplierorderstatic->id = $objp->rowid;
$supplierorderstatic->ref = $objp->ref;
$thirdpartytmp->id = $objp->socid;
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->email = $objp->email;
$thirdpartytmp->fournisseur = 1;
$thirdpartytmp->code_fournisseur = $objp->code_fournisseur;
$thirdpartytmp->logo = $objp->logo;
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->email = $objp->email;
$thirdpartytmp->fournisseur = 1;
$thirdpartytmp->code_fournisseur = $objp->code_fournisseur;
$thirdpartytmp->logo = $objp->logo;
$this->info_box_contents[$line][] = array(
'td' => 'class="nowraponall"',
'text' => $supplierorderstatic->getNomUrl(1),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="nowraponall"',
'text' => $supplierorderstatic->getNomUrl(1),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $thirdpartytmp->getNomUrl(1, 'supplier'),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $thirdpartytmp->getNomUrl(1, 'supplier'),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right nowraponall"',
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right nowraponall"',
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
$delayIcon = '';
if ($supplierorderstatic->hasDelay()) {
$delayIcon = img_warning($langs->trans("Late"));
}
$delayIcon = '';
if ($supplierorderstatic->hasDelay()) {
$delayIcon = img_warning($langs->trans("Late"));
}
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $delayIcon.'<span class="classfortooltip" title="'.$langs->trans('DateDeliveryPlanned').'"><i class="fa fa-dolly" ></i> '.dol_print_date($delivery_date, 'day').'</span>',
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $delayIcon.'<span class="classfortooltip" title="'.$langs->trans('DateDeliveryPlanned').'"><i class="fa fa-dolly" ></i> '.dol_print_date($delivery_date, 'day').'</span>',
'asis' => 1
);
$line++;
}
$line++;
}
if ($num == 0)
$this->info_box_contents[$line][] = array(
'td' => 'class="center"',
'text' => $langs->trans("NoSupplierOrder"),
);
if ($num == 0)
$this->info_box_contents[$line][] = array(
'td' => 'class="center"',
'text' => $langs->trans("NoSupplierOrder"),
);
$this->db->free($result);
} else {
$this->info_box_contents[0][] = array(
'td' => '',
'maxlength'=>500,
'text' => ($this->db->error().' sql='.$sql),
);
}
} else {
$this->info_box_contents[0][] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
$this->db->free($result);
} else {
$this->info_box_contents[0][] = array(
'td' => '',
'maxlength'=>500,
'text' => ($this->db->error().' sql='.$sql),
);
}
} else {
$this->info_box_contents[0][] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -296,11 +296,11 @@ abstract class CommonObject
*/
public $cond_reglement_id;
/**
* @var int Transport mode ID (For module intracomm report)
* @see setTransportMode()
*/
public $transport_mode_id;
/**
* @var int Transport mode ID (For module intracomm report)
* @see setTransportMode()
*/
public $transport_mode_id;
/**
* @var int Payment terms ID
@ -2196,42 +2196,42 @@ abstract class CommonObject
}
}
/**
* Change the transport mode methods
*
* @param int $id Id of new payment method
* @return int >0 if OK, <0 if KO
*/
public function setTransportMode($id)
{
dol_syslog(get_class($this).'::setTransportMode('.$id.')');
if ($this->statut >= 0 || $this->element == 'societe')
{
$fieldname = 'fk_transport_mode';
if ($this->element == 'societe') $fieldname = 'transport_mode';
if (get_class($this) == 'Fournisseur') $fieldname = 'transport_mode_supplier';
/**
* Change the transport mode methods
*
* @param int $id Id of new payment method
* @return int >0 if OK, <0 if KO
*/
public function setTransportMode($id)
{
dol_syslog(get_class($this).'::setTransportMode('.$id.')');
if ($this->statut >= 0 || $this->element == 'societe')
{
$fieldname = 'fk_transport_mode';
if ($this->element == 'societe') $fieldname = 'transport_mode';
if (get_class($this) == 'Fournisseur') $fieldname = 'transport_mode_supplier';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.(($id > 0 || $id == '0') ? $id : 'NULL');
$sql .= ' WHERE rowid='.$this->id;
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.(($id > 0 || $id == '0') ? $id : 'NULL');
$sql .= ' WHERE rowid='.$this->id;
if ($this->db->query($sql))
{
$this->transport_mode_id = $id;
// for supplier
if (get_class($this) == 'Fournisseur') $this->transport_mode_supplier_id = $id;
return 1;
} else {
dol_syslog(get_class($this).'::setTransportMode Error '.$sql.' - '.$this->db->error());
$this->error=$this->db->error();
return -1;
}
} else {
dol_syslog(get_class($this).'::setTransportMode, status of the object is incompatible');
$this->error='Status of the object is incompatible '.$this->statut;
return -2;
}
}
if ($this->db->query($sql))
{
$this->transport_mode_id = $id;
// for supplier
if (get_class($this) == 'Fournisseur') $this->transport_mode_supplier_id = $id;
return 1;
} else {
dol_syslog(get_class($this).'::setTransportMode Error '.$sql.' - '.$this->db->error());
$this->error=$this->db->error();
return -1;
}
} else {
dol_syslog(get_class($this).'::setTransportMode, status of the object is incompatible');
$this->error='Status of the object is incompatible '.$this->statut;
return -2;
}
}
/**
* Change the retained warranty payments terms
@ -2785,8 +2785,8 @@ abstract class CommonObject
*/
public function line_max($fk_parent_line = 0)
{
// phpcs:enable
$positionfield = 'rang';
// phpcs:enable
$positionfield = 'rang';
if ($this->table_element == 'bom_bom') $positionfield = 'position';
// Search the last rang with fk_parent_line

View File

@ -43,7 +43,7 @@ function propal_prepare_head($object)
$h++;
if ((empty($conf->commande->enabled) && ((!empty($conf->expedition->enabled) && !empty($conf->expedition_bon->enabled) && $user->rights->expedition->lire)
|| (!empty($conf->expedition->enabled) && !empty($conf->delivery_note->enabled) && $user->rights->expedition->delivery->lire))))
|| (!empty($conf->expedition->enabled) && !empty($conf->delivery_note->enabled) && $user->rights->expedition->delivery->lire))))
{
$langs->load("sendings");
$text = '';
@ -57,7 +57,7 @@ function propal_prepare_head($object)
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
@ -65,29 +65,29 @@ function propal_prepare_head($object)
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'propal');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'propal');
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$nbNote = 0;
if (!empty($object->note_private)) $nbNote++;
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$nbNote = 0;
if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
$head[$h][2] = 'note';
$h++;
}
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->propal->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->propal->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
@ -129,13 +129,13 @@ function propal_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propal_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes';
$h++;
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$head[$h][2] = 'attributeslines';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$head[$h][2] = 'attributeslines';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'propal_admin', 'remove');

View File

@ -37,7 +37,7 @@ function shipping_prepare_head($object)
global $db, $langs, $conf, $user;
// Load translation files required by the page
$langs->loadLangs(array("sendings", "deliveries"));
$langs->loadLangs(array("sendings", "deliveries"));
$h = 0;
$head = array();
@ -53,8 +53,8 @@ function shipping_prepare_head($object)
$object->fetchObjectLinked($object->id, $object->element);
if (is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery
{
// Take first one element of array
$tmp = reset($object->linkedObjectsIds['delivery']);
// Take first one element of array
$tmp = reset($object->linkedObjectsIds['delivery']);
$head[$h][0] = DOL_URL_ROOT."/delivery/card.php?id=".$tmp;
$head[$h][1] = $langs->trans("DeliveryCard");
@ -65,34 +65,34 @@ function shipping_prepare_head($object)
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$objectsrc = $object;
if ($object->origin == 'commande' && $object->origin_id > 0)
{
$objectsrc = new Commande($db);
$objectsrc->fetch($object->origin_id);
}
$nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id;
$head[$h][1] = $langs->trans("ContactsAddresses");
$objectsrc = $object;
if ($object->origin == 'commande' && $object->origin_id > 0)
{
$objectsrc = new Commande($db);
$objectsrc->fetch($object->origin_id);
}
$nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id;
$head[$h][1] = $langs->trans("ContactsAddresses");
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
$head[$h][2] = 'contact';
$h++;
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->commande->dir_output."/".dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
$head[$h][2] = 'documents';
$h++;
$nbNote = 0;
if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++;
$nbNote = 0;
if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->id;
$head[$h][1] = $langs->trans("Notes");
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
@ -101,8 +101,8 @@ function shipping_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove');
@ -122,7 +122,7 @@ function delivery_prepare_head($object)
global $langs, $db, $conf, $user;
// Load translation files required by the page
$langs->loadLangs(array("sendings", "deliveries"));
$langs->loadLangs(array("sendings", "deliveries"));
$h = 0;
$head = array();
@ -195,7 +195,7 @@ function delivery_prepare_head($object)
$object->id = $tmpobject->id;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove');
@ -262,7 +262,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
print '<td class="center">'.$langs->trans("QtyPreparedOrShipped").'</td>';
if (!empty($conf->stock->enabled))
{
print '<td>'.$langs->trans("Warehouse").'</td>';
print '<td>'.$langs->trans("Warehouse").'</td>';
}
/*TODO Add link to expeditiondet_batch
if (! empty($conf->productbatch->enabled))
@ -371,13 +371,13 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
// Warehouse
if (!empty($conf->stock->enabled))
{
print '<td>';
if ($objp->warehouse_id > 0)
{
$warehousestatic->fetch($objp->warehouse_id);
print $warehousestatic->getNomUrl(1);
}
print '</td>';
print '<td>';
if ($objp->warehouse_id > 0)
{
$warehousestatic->fetch($objp->warehouse_id);
print $warehousestatic->getNomUrl(1);
}
print '</td>';
}
// Batch number managment

View File

@ -32,9 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/delivery/modules_delivery.php';
class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
{
/**
* Dolibarr version of the loaded document
* @var string
*/
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
@ -55,14 +55,14 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
public $name = 'Saphir';
/**
* Returns the description of the numbering model
*
* @return string Texte descripif
*/
public function info()
{
global $conf, $langs, $db;
/**
* Returns the description of the numbering model
*
* @return string Texte descripif
*/
public function info()
{
global $conf, $langs, $db;
$langs->load("bills");
@ -93,28 +93,28 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
$texte .= '</form>';
return $texte;
}
}
/**
* Return an example of number
*
* @return string Example
*/
public function getExample()
{
global $conf, $langs, $mysoc;
/**
* Return an example of number
*
* @return string Example
*/
public function getExample()
{
global $conf, $langs, $mysoc;
$old_code_client = $mysoc->code_client;
$mysoc->code_client = 'CCCCCCCCCC';
$old_code_client = $mysoc->code_client;
$mysoc->code_client = 'CCCCCCCCCC';
$numExample = $this->getNextValue($mysoc, '');
$mysoc->code_client = $old_code_client;
$mysoc->code_client = $old_code_client;
if (!$numExample)
{
$numExample = $langs->trans('NotConfigured');
}
return $numExample;
}
}
/**
@ -124,8 +124,8 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
* @param Object $object Object delivery
* @return string Value if OK, 0 if KO
*/
public function getNextValue($objsoc, $object)
{
public function getNextValue($objsoc, $object)
{
global $db, $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -142,33 +142,33 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
$numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->date_livraison);
return $numFinal;
}
}
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @return string Next free value
*/
public function getNumRef($objsoc, $objforref)
{
return $this->getNextValue($objsoc, $objforref);
}
* @return string Next free value
*/
public function getNumRef($objsoc, $objforref)
{
return $this->getNextValue($objsoc, $objforref);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free ref
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Objet livraison
* @return string Texte descripif
*/
public function delivery_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free ref
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Objet livraison
* @return string Texte descripif
*/
public function delivery_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
}
}

View File

@ -41,8 +41,8 @@ if (!empty($conf->expedition_bon->enabled))
if (!empty($conf->stock->enabled))
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
if (!empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
// Load translation files required by the page
@ -126,8 +126,8 @@ if ($action == 'add')
$action = 'create';
}
} elseif ($action == 'confirm_valid' && $confirm == 'yes' &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
)
{
$result = $object->valid($user);
@ -310,13 +310,13 @@ if ($action == 'create') // Create. Seems to no be used
if ($typeobject == 'commande' && $expedition->origin_id > 0 && !empty($conf->commande->enabled))
{
$objectsrc = new Commande($db);
$objectsrc->fetch($expedition->origin_id);
$objectsrc = new Commande($db);
$objectsrc->fetch($expedition->origin_id);
}
if ($typeobject == 'propal' && $expedition->origin_id > 0 && !empty($conf->propal->enabled))
{
$objectsrc = new Propal($db);
$objectsrc->fetch($expedition->origin_id);
$objectsrc = new Propal($db);
$objectsrc->fetch($expedition->origin_id);
}
// Shipment card
@ -331,35 +331,35 @@ if ($action == 'create') // Create. Seems to no be used
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$expedition->thirdparty->getNomUrl(1);
// Project
if (!empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
if (0) { // Do not change on shipment
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$expedition->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
}
if ($action == 'classify') {
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $expedition->id, $expedition->socid, $expedition->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$expedition->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($expedition->socid, $expedition->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$expedition->id, $expedition->socid, $expedition->fk_project, 'none', 0, 0, 0, 1);
}
} else {
$morehtmlref .= ' : ';
if (!empty($objectsrc->fk_project)) {
$proj = new Project($db);
$proj->fetch($objectsrc->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$objectsrc->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
} else {
$morehtmlref .= '';
}
}
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
if (0) { // Do not change on shipment
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$expedition->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
}
if ($action == 'classify') {
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $expedition->id, $expedition->socid, $expedition->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$expedition->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($expedition->socid, $expedition->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$expedition->id, $expedition->socid, $expedition->fk_project, 'none', 0, 0, 0, 1);
}
} else {
$morehtmlref .= ' : ';
if (!empty($objectsrc->fk_project)) {
$proj = new Project($db);
$proj->fetch($objectsrc->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$objectsrc->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
} else {
$morehtmlref .= '';
}
}
}
$morehtmlref .= '</div>';
@ -371,7 +371,7 @@ if ($action == 'create') // Create. Seems to no be used
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield" width="100%">';
// Shipment
/*
@ -454,21 +454,21 @@ if ($action == 'create') // Create. Seems to no be used
if (!empty($conf->incoterm->enabled))
{
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
print '<td><td class="right">';
if ($user->rights->expedition->delivery->creer) print '<a class="editfielda" href="'.DOL_URL_ROOT.'/delivery/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
else print '&nbsp;';
print '</td></tr></table>';
print '</td>';
print '<td colspan="3">';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
print '<td><td class="right">';
if ($user->rights->expedition->delivery->creer) print '<a class="editfielda" href="'.DOL_URL_ROOT.'/delivery/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
else print '&nbsp;';
print '</td></tr></table>';
print '</td>';
print '<td colspan="3">';
if ($action != 'editincoterm')
{
print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
} else {
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>';
}
/* A delivery note should be just more properties of a shipment, so notes are on shipment
@ -690,9 +690,9 @@ if ($action == 'create') // Create. Seems to no be used
$shipment = new Expedition($db);
$shipment->fetch($object->origin_id);
// Show links to link elements
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
$somethingshown = $form->showLinkedObjectBlock($object, '');
// Show links to link elements
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
$somethingshown = $form->showLinkedObjectBlock($object, '');
}

View File

@ -88,8 +88,8 @@ class Delivery extends CommonObject
public $date_delivery;
/**
* @var integer|string date_creation
*/
* @var integer|string date_creation
*/
public $date_creation;
/**
@ -108,7 +108,7 @@ class Delivery extends CommonObject
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct($db)
{
$this->db = $db;
$this->lines = array();
@ -126,7 +126,7 @@ class Delivery extends CommonObject
* @param User $user Objet du user qui cree
* @return int <0 si erreur, id delivery cree si ok
*/
public function create($user)
public function create($user)
{
global $conf;
@ -136,7 +136,7 @@ class Delivery extends CommonObject
$error = 0;
$now = dol_now();
$now = dol_now();
/* Delivery note as draft On positionne en mode draft le bon de livraison */
$this->draft = 1;
@ -170,8 +170,8 @@ class Delivery extends CommonObject
$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");
$sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null");
$sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
$sql .= ", ".(int) $this->fk_incoterms;
$sql .= ", '".$this->db->escape($this->location_incoterms)."'";
$sql .= ", ".(int) $this->fk_incoterms;
$sql .= ", '".$this->db->escape($this->location_incoterms)."'";
$sql .= ")";
dol_syslog("Delivery::create", LOG_DEBUG);
@ -256,7 +256,7 @@ class Delivery extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a line
*
@ -266,9 +266,9 @@ class Delivery extends CommonObject
* @param string $description Description
* @return int <0 if KO, >0 if OK
*/
public function create_line($origin_id, $qty, $fk_product, $description)
{
// phpcs:enable
public function create_line($origin_id, $qty, $fk_product, $description)
{
// phpcs:enable
$error = 0;
$idprod = $fk_product;
$j = 0;
@ -298,7 +298,7 @@ class Delivery extends CommonObject
* @param int $id Id of object to load
* @return integer
*/
public function fetch($id)
public function fetch($id)
{
global $conf;
@ -306,8 +306,8 @@ class Delivery extends CommonObject
$sql .= " l.total_ht, l.fk_statut, l.fk_user_valid, l.note_private, l.note_public";
$sql .= ", l.date_delivery, l.fk_address, l.model_pdf";
$sql .= ", el.fk_source as origin_id, el.sourcetype as origin";
$sql .= ', l.fk_incoterms, l.location_incoterms';
$sql .= ", i.libelle as label_incoterms";
$sql .= ', l.fk_incoterms, l.location_incoterms';
$sql .= ", i.libelle as label_incoterms";
$sql .= " FROM ".MAIN_DB_PREFIX."delivery as l";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = l.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON l.fk_incoterms = i.rowid';
@ -374,14 +374,14 @@ class Delivery extends CommonObject
/**
* Validate object and update stock if option enabled
*
* @param User $user Object user that validate
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int
* @param User $user Object user that validate
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int
*/
public function valid($user, $notrigger = 0)
public function valid($user, $notrigger = 0)
{
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_syslog(get_class($this)."::valid begin");
@ -389,8 +389,8 @@ class Delivery extends CommonObject
$error = 0;
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
{
if (!empty($conf->global->DELIVERY_ADDON_NUMBER))
{
@ -409,12 +409,12 @@ class Delivery extends CommonObject
$soc->fetch($this->socid);
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life
{
$numref = $objMod->delivery_get_num($soc, $this);
} else {
$numref = $this->ref;
}
$this->newref = dol_sanitizeFileName($numref);
{
$numref = $objMod->delivery_get_num($soc, $this);
} else {
$numref = $this->ref;
}
$this->newref = dol_sanitizeFileName($numref);
// Test if is not already in valid status. If so, we stop to avoid decrementing the stock twice.
$sql = "SELECT ref";
@ -442,24 +442,24 @@ class Delivery extends CommonObject
$sql .= " AND fk_statut = 0";
$resql = $this->db->query($sql);
if (!$resql)
{
dol_print_error($this->db);
$this->error = $this->db->lasterror();
$error++;
}
if (!$resql)
{
dol_print_error($this->db);
$this->error = $this->db->lasterror();
$error++;
}
if (!$error && !$notrigger)
{
// Call trigger
$result = $this->call_trigger('DELIVERY_VALIDATE', $user);
if ($result < 0) $error++;
// End call triggers
}
if (!$error && !$notrigger)
{
// Call trigger
$result = $this->call_trigger('DELIVERY_VALIDATE', $user);
if ($result < 0) $error++;
// End call triggers
}
if (!$error)
{
$this->oldref = $this->ref;
$this->oldref = $this->ref;
// Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
@ -481,17 +481,17 @@ class Delivery extends CommonObject
if (@rename($dirsource, $dirdest))
{
dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref
$listoffiles = dol_dir_list($conf->expedition->dir_output.'/receipt/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
foreach ($listoffiles as $fileentry)
{
$dirsource = $fileentry['name'];
$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
$dirsource = $fileentry['path'].'/'.$dirsource;
$dirdest = $fileentry['path'].'/'.$dirdest;
@rename($dirsource, $dirdest);
}
dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref
$listoffiles = dol_dir_list($conf->expedition->dir_output.'/receipt/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
foreach ($listoffiles as $fileentry)
{
$dirsource = $fileentry['name'];
$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
$dirsource = $fileentry['path'].'/'.$dirsource;
$dirdest = $fileentry['path'].'/'.$dirdest;
@rename($dirsource, $dirdest);
}
}
}
}
@ -506,14 +506,14 @@ class Delivery extends CommonObject
dol_syslog(get_class($this)."::valid ok");
}
if (!$error)
{
$this->db->commit();
return 1;
} else {
$this->db->rollback();
return -1;
}
if (!$error)
{
$this->db->commit();
return 1;
} else {
$this->db->rollback();
return -1;
}
}
}
} else {
@ -523,7 +523,7 @@ class Delivery extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Creating the delivery slip from an existing shipment
*
@ -531,9 +531,9 @@ class Delivery extends CommonObject
* @param int $sending_id Id of the expedition that serves as a model
* @return integer
*/
public function create_from_sending($user, $sending_id)
public function create_from_sending($user, $sending_id)
{
// phpcs:enable
// phpcs:enable
$expedition = new Expedition($this->db);
$result = $expedition->fetch($sending_id);
@ -569,7 +569,7 @@ class Delivery extends CommonObject
return $this->create($user);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update a livraison line (only extrafields)
*
@ -577,9 +577,9 @@ class Delivery extends CommonObject
* @param array $array_options extrafields array
* @return int <0 if KO, >0 if OK
*/
public function update_line($id, $array_options = 0)
public function update_line($id, $array_options = 0)
{
// phpcs:enable
// phpcs:enable
global $conf;
$error = 0;
@ -609,7 +609,7 @@ class Delivery extends CommonObject
* @param int $qty Qty
* @return void
*/
public function addline($origin_id, $qty)
public function addline($origin_id, $qty)
{
$num = count($this->lines);
$line = new DeliveryLine($this->db);
@ -626,7 +626,7 @@ class Delivery extends CommonObject
* @param int $lineid Line id
* @return integer|null
*/
public function deleteline($lineid)
public function deleteline($lineid)
{
if ($this->statut == 0)
{
@ -649,11 +649,11 @@ class Delivery extends CommonObject
*
* @return integer
*/
public function delete()
public function delete()
{
global $conf, $langs, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$this->db->begin();
$error = 0;
@ -697,14 +697,14 @@ class Delivery extends CommonObject
}
}
// Call trigger
$result = $this->call_trigger('DELIVERY_DELETE', $user);
if ($result < 0)
{
$this->db->rollback();
return -4;
}
// End call triggers
// Call trigger
$result = $this->call_trigger('DELIVERY_DELETE', $user);
if ($result < 0)
{
$this->db->rollback();
return -4;
}
// End call triggers
return 1;
} else {
@ -728,10 +728,10 @@ class Delivery extends CommonObject
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/
public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1)
public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1)
{
global $langs;
@ -742,16 +742,16 @@ class Delivery extends CommonObject
$url = DOL_URL_ROOT.'/delivery/card.php?id='.$this->id;
//if ($option !== 'nolink')
//{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
//}
//if ($option !== 'nolink')
//{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
//}
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend = '</a>';
if ($withpicto) $result .= ($linkstart.img_object($label, $this->picto, 'class="classfortooltip"').$linkend);
@ -760,15 +760,15 @@ class Delivery extends CommonObject
return $result;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load lines
*
* @return void
*/
public function fetch_lines()
public function fetch_lines()
{
// phpcs:enable
// phpcs:enable
$this->lines = array();
$sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped, ld.fk_origin_line, ";
@ -844,12 +844,12 @@ class Delivery extends CommonObject
* @param int $mode Mode
* @return string Label
*/
public function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@ -857,9 +857,9 @@ class Delivery extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label
*/
public function LibStatut($status, $mode)
public function LibStatut($status, $mode)
{
// phpcs:enable
// phpcs:enable
global $langs;
if (empty($this->labelStatus) || empty($this->labelStatusShort))
@ -883,19 +883,19 @@ class Delivery extends CommonObject
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
public function initAsSpecimen()
public function initAsSpecimen()
{
global $user, $langs, $conf;
$now = dol_now();
// Load array of products prodids
// Load array of products prodids
$num_prods = 0;
$prodids = array();
$sql = "SELECT rowid";
@ -946,7 +946,7 @@ class Delivery extends CommonObject
* @return array Product remaining to be delivered
* TODO use new function
*/
public function getRemainingDelivered()
public function getRemainingDelivered()
{
global $langs;
@ -1148,13 +1148,13 @@ class DeliveryLine extends CommonObjectLine
public $product_ref;
public $product_label;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
}

View File

@ -159,8 +159,8 @@ class Expedition extends CommonObject
public $date_shipping;
/**
* @var integer|string date_creation
*/
* @var integer|string date_creation
*/
public $date_creation;
/**
@ -171,7 +171,7 @@ class Expedition extends CommonObject
public $meths;
public $listmeths; // List of carriers
/**
/**
* Draft status
*/
const STATUS_DRAFT = 0;
@ -441,7 +441,7 @@ class Expedition extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a expedition line
*
@ -473,7 +473,7 @@ class Expedition extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create the detail (eat-by date) of the expedition line
*
@ -483,7 +483,7 @@ class Expedition extends CommonObject
*/
public function create_line_batch($line_ext, $array_options = 0)
{
// phpcs:enable
// phpcs:enable
$error = 0;
$stockLocationQty = array(); // associated array with batch qty in stock location
@ -537,7 +537,7 @@ class Expedition extends CommonObject
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
$sql = "SELECT e.rowid, e.entity, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed";
$sql .= ", e.date_valid";
$sql .= ", e.date_valid";
$sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
$sql .= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery";
$sql .= ", e.fk_shipping_method, e.tracking_number";
@ -574,7 +574,7 @@ class Expedition extends CommonObject
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_valid = $this->db->jdate($obj->date_valid);
$this->date_valid = $this->db->jdate($obj->date_valid);
$this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated
$this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO deprecated
$this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real
@ -868,7 +868,7 @@ class Expedition extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a delivery receipt from a shipment
*
@ -877,7 +877,7 @@ class Expedition extends CommonObject
*/
public function create_delivery($user)
{
// phpcs:enable
// phpcs:enable
global $conf;
if ($conf->delivery_note->enabled)
@ -974,7 +974,7 @@ class Expedition extends CommonObject
$this->lines[$num] = $line;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add a shipment line with batch record
*
@ -984,7 +984,7 @@ class Expedition extends CommonObject
*/
public function addline_batch($dbatch, $array_options = 0)
{
// phpcs:enable
// phpcs:enable
global $conf, $langs;
$num = count($this->lines);
@ -1154,7 +1154,7 @@ class Expedition extends CommonObject
* Cancel shipment.
*
* @param int $notrigger Disable triggers
* @param bool $also_update_stock true if the stock should be increased back (false by default)
* @param bool $also_update_stock true if the stock should be increased back (false by default)
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
*/
public function cancel($notrigger = 0, $also_update_stock = false)
@ -1360,7 +1360,7 @@ class Expedition extends CommonObject
* Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element)
*
* @param int $notrigger Disable triggers
* @param bool $also_update_stock true if the stock should be increased back (false by default)
* @param bool $also_update_stock true if the stock should be increased back (false by default)
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
*/
public function delete($notrigger = 0, $also_update_stock = false)
@ -1474,9 +1474,9 @@ class Expedition extends CommonObject
if (!$error)
{
$main = MAIN_DB_PREFIX.'expeditiondet';
$ef = $main."_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = ".$this->id.")";
$main = MAIN_DB_PREFIX.'expeditiondet';
$ef = $main."_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = ".$this->id.")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";
$sql .= " WHERE fk_expedition = ".$this->id;
@ -1487,9 +1487,9 @@ class Expedition extends CommonObject
$res = $this->deleteObjectLinked();
if ($res < 0) $error++;
// delete extrafields
$res = $this->deleteExtraFields();
if ($res < 0) $error++;
// delete extrafields
$res = $this->deleteExtraFields();
if ($res < 0) $error++;
if (!$error)
{
@ -1570,7 +1570,7 @@ class Expedition extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load lines
*
@ -1578,7 +1578,7 @@ class Expedition extends CommonObject
*/
public function fetch_lines()
{
// phpcs:enable
// phpcs:enable
global $conf, $mysoc;
// TODO: recuperer les champs du document associe a part
$this->lines = array();
@ -1854,7 +1854,7 @@ class Expedition extends CommonObject
return $this->LibStatut($this->statut, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return label of a status
*
@ -1864,8 +1864,8 @@ class Expedition extends CommonObject
*/
public function LibStatut($status, $mode)
{
// phpcs:enable
global $langs;
// phpcs:enable
global $langs;
$labelStatus = $langs->trans($this->statuts[$status]);
$labelStatusShort = $langs->trans($this->statutshorts[$status]);
@ -2002,7 +2002,7 @@ class Expedition extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fetch deliveries method and return an array. Load array this->meths(rowid=>label).
*
@ -2030,7 +2030,7 @@ class Expedition extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fetch all deliveries method and return an array. Load array this->listmeths.
*
@ -2039,7 +2039,7 @@ class Expedition extends CommonObject
*/
public function list_delivery_methods($id = '')
{
// phpcs:enable
// phpcs:enable
global $langs;
$this->listmeths = array();
@ -2066,7 +2066,7 @@ class Expedition extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update/create delivery method.
*
@ -2110,7 +2110,7 @@ class Expedition extends CommonObject
$resql = $this->db->query($sql);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* DesActivate delivery method.
*
@ -2308,7 +2308,7 @@ class Expedition extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
*
@ -2316,7 +2316,7 @@ class Expedition extends CommonObject
*/
public function set_billed()
{
// phpcs:enable
// phpcs:enable
global $user;
$error = 0;
@ -2450,13 +2450,13 @@ class Expedition extends CommonObject
}
}
if (!$error) {
if (!$error) {
// Call trigger
$result = $this->call_trigger('SHIPPING_REOPEN', $user);
if ($result < 0) {
$error++;
}
}
}
} else {
$error++;
$this->errors[] = $this->db->lasterror();
@ -2482,7 +2482,7 @@ class Expedition extends CommonObject
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param null|array $moreparams Array to provide more information
* @param null|array $moreparams Array to provide more information
* @return int 0 if KO, 1 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
@ -2550,8 +2550,8 @@ class ExpeditionLigne extends CommonObjectLine
public $origin_line_id;
/**
* @var int ID
*/
* @var int ID
*/
public $fk_origin_line;
/**
@ -2560,42 +2560,42 @@ class ExpeditionLigne extends CommonObjectLine
public $fk_expedition;
/**
* @var DoliDB Database handler.
*/
public $db;
* @var DoliDB Database handler.
*/
public $db;
/**
* @var float qty asked From llx_expeditiondet
*/
public $qty;
/**
* @var float qty asked From llx_expeditiondet
*/
public $qty;
/**
* @var float qty shipped
*/
public $qty_shipped;
/**
* @var float qty shipped
*/
public $qty_shipped;
/**
* @var int Id of product
*/
public $fk_product;
public $detail_batch;
/**
* @var int Id of product
*/
public $fk_product;
public $detail_batch;
/**
* @var int Id of warehouse
*/
/**
* @var int Id of warehouse
*/
public $entrepot_id;
/**
* @var float qty asked From llx_commandedet or llx_propaldet
*/
/**
* @var float qty asked From llx_commandedet or llx_propaldet
*/
public $qty_asked;
/**
* @deprecated
* @see $product_ref
*/
public $ref;
/**
* @deprecated
* @see $product_ref
*/
public $ref;
/**
* @var string product ref
@ -2608,87 +2608,87 @@ class ExpeditionLigne extends CommonObjectLine
*/
public $libelle;
/**
* @var string product label
*/
/**
* @var string product label
*/
public $product_label;
/**
* @var string product description
* @deprecated
* @see $product_desc
*/
public $desc;
/**
* @var string product description
* @deprecated
* @see $product_desc
*/
public $desc;
/**
* @var string product description
*/
/**
* @var string product description
*/
public $product_desc;
/**
* @var int rang of line
*/
public $rang;
/**
* @var int rang of line
*/
public $rang;
/**
* @var float weight
*/
public $weight;
public $weight_units;
/**
* @var float weight
*/
public $weight;
public $weight_units;
/**
* @var float weight
*/
public $length;
public $length_units;
/**
* @var float weight
*/
public $length;
public $length_units;
/**
* @var float weight
*/
public $surface;
public $surface_units;
/**
* @var float weight
*/
public $surface;
public $surface_units;
/**
* @var float weight
*/
public $volume;
public $volume_units;
/**
* @var float weight
*/
public $volume;
public $volume_units;
// Invoicing
public $remise_percent;
public $tva_tx;
public $tva_tx;
/**
* @var float total without tax
*/
public $total_ht;
/**
* @var float total without tax
*/
public $total_ht;
/**
* @var float total with tax
*/
public $total_ttc;
/**
* @var float total with tax
*/
public $total_ttc;
/**
* @var float total vat
*/
public $total_tva;
/**
* @var float total vat
*/
public $total_tva;
/**
* @var float total localtax 1
*/
public $total_localtax1;
/**
* @var float total localtax 1
*/
public $total_localtax1;
/**
* @var float total localtax 2
*/
public $total_localtax2;
/**
* @var float total localtax 2
*/
public $total_localtax2;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;

View File

@ -124,100 +124,100 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors');
}
*/
if ($action == 'setmode' && $user->rights->commande->creer)
{
$object = new Commande($db);
$object->fetch($id);
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'setmode' && $user->rights->commande->creer)
{
$object = new Commande($db);
$object->fetch($id);
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'setavailability' && $user->rights->commande->creer) {
$object = new Commande($db);
$object->fetch($id);
$result = $object->availability(GETPOST('availability_id'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'setavailability' && $user->rights->commande->creer) {
$object = new Commande($db);
$object->fetch($id);
$result = $object->availability(GETPOST('availability_id'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'setdemandreason' && $user->rights->commande->creer) {
$object = new Commande($db);
$object->fetch($id);
$result = $object->demand_reason(GETPOST('demand_reason_id'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'setdemandreason' && $user->rights->commande->creer) {
$object = new Commande($db);
$object->fetch($id);
$result = $object->demand_reason(GETPOST('demand_reason_id'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'setconditions' && $user->rights->commande->creer)
{
$object = new Commande($db);
$object->fetch($id);
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'setconditions' && $user->rights->commande->creer)
{
$object = new Commande($db);
$object->fetch($id);
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
// 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');
}
}
// 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');
}
}
// shipping method
if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
$object = new Commande($db);
$object->fetch($id);
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
// shipping method
if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
$object = new Commande($db);
$object->fetch($id);
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
// warehouse
if ($action == 'setwarehouse' && $user->rights->commande->creer) {
$object = new Commande($db);
$object->fetch($id);
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
// warehouse
if ($action == 'setwarehouse' && $user->rights->commande->creer) {
$object = new Commande($db);
$object->fetch($id);
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'update_extras')
{
$object->oldcopy = dol_clone($object);
if ($action == 'update_extras')
{
$object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from update form
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
if ($ret < 0) $error++;
// Fill array 'array_options' with data from update form
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
if ($ret < 0) $error++;
if (!$error)
{
// Actions on extra fields
$result = $object->insertExtraFields('SHIPMENT_MODIFY');
if (!$error)
{
// Actions on extra fields
$result = $object->insertExtraFields('SHIPMENT_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
}
if ($error)
$action = 'edit_extras';
}
if ($error)
$action = 'edit_extras';
}
if ($action == 'set_thirdparty' && $user->rights->commande->creer)
{
$object->fetch($id);
$object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
if ($action == 'set_thirdparty' && $user->rights->commande->creer)
{
$object->fetch($id);
$object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit();
}
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit();
}
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
}
/*
@ -280,61 +280,61 @@ if ($id > 0 || !empty($ref))
// 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);
// Project
if (!empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($user->rights->commande->creer)
{
if ($action != 'classify') {
// Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1);
// Project
if (!empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($user->rights->commande->creer)
{
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" 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="'.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>';
}
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="'.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 centpercent tableforfield">';
print '<table class="border centpercent tableforfield">';
// Discounts for third party
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
$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 (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
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
$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 (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
print '<tr><td class="titlefield">'.$langs->trans('Discounts').'</td><td colspan="3">';
@ -355,7 +355,7 @@ if ($id > 0 || !empty($ref))
print '<td colspan="2">';
print dol_print_date($object->date, 'day');
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>';
@ -380,7 +380,7 @@ if ($id > 0 || !empty($ref))
} else {
print dol_print_date($object->date_livraison, 'dayhour');
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>';
@ -390,43 +390,43 @@ if ($id > 0 || !empty($ref))
//print '</td>';
print '</tr>';
// Shipping Method
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('SendingMethod');
print '</td>';
if ($action != 'editshippingmethod' && $user->rights->expedition->creer)
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&amp;id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
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
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('SendingMethod');
print '</td>';
if ($action != 'editshippingmethod' && $user->rights->expedition->creer)
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&amp;id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
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->stock->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 class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&amp;id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'), 1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
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->stock->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 class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&amp;id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'), 1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
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
/*
@ -502,14 +502,14 @@ if ($id > 0 || !empty($ref))
$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)
@ -517,22 +517,22 @@ if ($id > 0 || !empty($ref))
// Incoterms
if (!empty($conf->incoterm->enabled))
{
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
print '<td><td class="right">';
if ($user->rights->commande->creer) print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'/expedition/shipment.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
else print '&nbsp;';
print '</td></tr></table>';
print '</td>';
print '<td colspan="3">';
if ($action != 'editincoterm')
{
print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
} else {
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 '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
print '<td><td class="right">';
if ($user->rights->commande->creer) print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'/expedition/shipment.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
else print '&nbsp;';
print '</td></tr></table>';
print '</td>';
print '<td colspan="3">';
if ($action != 'editincoterm')
{
print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
} else {
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>';
}
$expe = new Expedition($db);
@ -553,20 +553,20 @@ if ($id > 0 || !empty($ref))
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
{
// Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</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">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</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>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</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>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</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>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</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>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</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
@ -581,13 +581,13 @@ if ($id > 0 || !empty($ref))
// Amount Local Taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
{
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
print '<td>'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
print '<td>'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
print '<td>'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
print '<td>'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
}
// Total TTC
@ -676,8 +676,8 @@ if ($id > 0 || !empty($ref))
$object->fetch_thirdparty();
$prod = new Product($db);
$prod->id = $objp->fk_product;
$prod->entity = $objp->entity;
$prod->id = $objp->fk_product;
$prod->entity = $objp->entity;
$prod->getMultiLangs();
$outputlangs = $langs;
@ -700,25 +700,25 @@ if ($id > 0 || !empty($ref))
$product_static->type = $type;
$product_static->id = $objp->fk_product;
$product_static->ref = $objp->ref;
$product_static->entity = $objp->entity;
$product_static->entity = $objp->entity;
$product_static->weight = $objp->weight;
$product_static->weight_units = $objp->weight_units;
$product_static->length = $objp->length;
$product_static->length_units = $objp->length_units;
$product_static->width = $objp->width;
$product_static->width_units = $objp->width_units;
$product_static->height = $objp->height;
$product_static->height_units = $objp->height_units;
$product_static->surface = $objp->surface;
$product_static->surface_units = $objp->surface_units;
$product_static->volume = $objp->volume;
$product_static->volume_units = $objp->volume_units;
$product_static->weight = $objp->weight;
$product_static->weight_units = $objp->weight_units;
$product_static->length = $objp->length;
$product_static->length_units = $objp->length_units;
$product_static->width = $objp->width;
$product_static->width_units = $objp->width_units;
$product_static->height = $objp->height;
$product_static->height_units = $objp->height_units;
$product_static->surface = $objp->surface;
$product_static->surface_units = $objp->surface_units;
$product_static->volume = $objp->volume;
$product_static->volume_units = $objp->volume_units;
$text = $product_static->getNomUrl(1);
$text .= ' - '.$label;
$description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($objp->description)).'<br>';
$description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
$description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
print $form->textwithtooltip($text, $description, 3, '', '', $i);
// Show range
@ -845,8 +845,8 @@ if ($id > 0 || !empty($ref))
{
print '<div class="tabsAction">';
// Bouton expedier sans gestion des stocks
if (empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED))
// Bouton expedier sans gestion des stocks
if (empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED))
{
if ($user->rights->expedition->creer)
{
@ -863,24 +863,24 @@ if ($id > 0 || !empty($ref))
}
// Bouton expedier avec gestion des stocks
// Bouton expedier avec gestion des stocks
if (!empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT)
{
print $langs->trans("ValidateOrderFirstBeforeShipment");
}
if (!empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT)
{
print $langs->trans("ValidateOrderFirstBeforeShipment");
}
if (!empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED))
{
if ($user->rights->expedition->creer)
{
//print load_fiche_titre($langs->trans("CreateShipment"));
print '<div class="tabsAction">';
print '<div class="tabsAction">';
print '<form method="GET" action="'.DOL_URL_ROOT.'/expedition/card.php">';
print '<input type="hidden" name="action" value="create">';
//print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="shipping_method_id" value="'.$object->shipping_method_id.'">';
print '<input type="hidden" name="shipping_method_id" value="'.$object->shipping_method_id.'">';
print '<input type="hidden" name="origin" value="commande">';
print '<input type="hidden" name="origin_id" value="'.$object->id.'">';
print '<input type="hidden" name="projectid" value="'.$object->fk_project.'">';

View File

@ -2219,37 +2219,37 @@ class FactureFournisseur extends CommonInvoice
if ($user->socid) $sql .= ' AND ff.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
$resql = $this->db->query($sql);
if ($resql)
{
$langs->load("bills");
$now = dol_now();
$resql = $this->db->query($sql);
if ($resql)
{
$langs->load("bills");
$now = dol_now();
$response = new WorkboardResponse();
$response->warning_delay = $conf->facture->fournisseur->warning_delay / 60 / 60 / 24;
$response->label = $langs->trans("SupplierBillsToPay");
$response->labelShort = $langs->trans("StatusToPay");
$response = new WorkboardResponse();
$response->warning_delay = $conf->facture->fournisseur->warning_delay / 60 / 60 / 24;
$response->label = $langs->trans("SupplierBillsToPay");
$response->labelShort = $langs->trans("StatusToPay");
$response->url = DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&amp;mainmenu=billing&amp;leftmenu=suppliers_bills';
$response->img = img_object($langs->trans("Bills"), "bill");
$response->url = DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&amp;mainmenu=billing&amp;leftmenu=suppliers_bills';
$response->img = img_object($langs->trans("Bills"), "bill");
$facturestatic = new FactureFournisseur($this->db);
$facturestatic = new FactureFournisseur($this->db);
while ($obj = $this->db->fetch_object($resql))
{
$response->nbtodo++;
while ($obj = $this->db->fetch_object($resql))
{
$response->nbtodo++;
$facturestatic->date_echeance = $this->db->jdate($obj->datefin);
$facturestatic->statut = $obj->fk_statut;
$facturestatic->date_echeance = $this->db->jdate($obj->datefin);
$facturestatic->statut = $obj->fk_statut;
if ($facturestatic->hasDelay()) {
$response->nbtodolate++;
if ($facturestatic->hasDelay()) {
$response->nbtodolate++;
$response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
}
}
$this->db->free($resql);
return $response;
} else {
}
}
$this->db->free($resql);
return $response;
} else {
dol_print_error($this->db);
$this->error = $this->db->error();
return -1;

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