NEW incoterms
This commit is contained in:
parent
890239e02a
commit
8de4d3d1a4
@ -39,6 +39,8 @@ CREATE TABLE llx_stocktransfer_stocktransfer(
|
|||||||
import_key varchar(14),
|
import_key varchar(14),
|
||||||
model_pdf varchar(255),
|
model_pdf varchar(255),
|
||||||
last_main_doc varchar(255),
|
last_main_doc varchar(255),
|
||||||
status smallint NOT NULL
|
status smallint NOT NULL,
|
||||||
|
fk_incoterms integer, -- for incoterms
|
||||||
|
location_incoterms varchar(255)
|
||||||
-- END MODULEBUILDER FIELDS
|
-- END MODULEBUILDER FIELDS
|
||||||
) ENGINE=innodb;
|
) ENGINE=innodb;
|
||||||
|
|||||||
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
// Put here all includes required by your class file
|
// Put here all includes required by your class file
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php';
|
||||||
|
|
||||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
|
|
||||||
@ -33,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
|||||||
*/
|
*/
|
||||||
class StockTransfer extends CommonObject
|
class StockTransfer extends CommonObject
|
||||||
{
|
{
|
||||||
|
use CommonIncoterm;
|
||||||
/**
|
/**
|
||||||
* @var string ID to identify managed object.
|
* @var string ID to identify managed object.
|
||||||
*/
|
*/
|
||||||
@ -118,6 +121,8 @@ class StockTransfer extends CommonObject
|
|||||||
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'ChangedBy', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
|
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'ChangedBy', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
|
||||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
|
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
|
||||||
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
|
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
|
||||||
|
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-2, 'position'=>220),
|
||||||
|
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-2, 'position'=>225),
|
||||||
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>5, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'StockStransferDecremented', '3'=>'StockStransferIncremented'),),
|
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>5, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'StockStransferDecremented', '3'=>'StockStransferIncremented'),),
|
||||||
);
|
);
|
||||||
public $rowid;
|
public $rowid;
|
||||||
|
|||||||
@ -70,6 +70,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/stocktransfer/modules_stocktransfe
|
|||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("stocks", "other", "productbatch", "companies"));
|
$langs->loadLangs(array("stocks", "other", "productbatch", "companies"));
|
||||||
|
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
@ -361,7 +362,11 @@ if (empty($reshook)) {
|
|||||||
setEventMessage('StockStransferIncrementedShortCancel', 'warnings');
|
setEventMessage('StockStransferIncrementedShortCancel', 'warnings');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Set incoterm
|
||||||
|
if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $permissiontoadd)
|
||||||
|
{
|
||||||
|
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||||
|
}
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$triggersendname = 'STOCKTRANSFER_SENTBYMAIL';
|
$triggersendname = 'STOCKTRANSFER_SENTBYMAIL';
|
||||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_STOCKTRANSFER_TO';
|
$autocopy = 'MAIN_MAIL_AUTOCOPY_STOCKTRANSFER_TO';
|
||||||
@ -422,6 +427,14 @@ if ($action == 'create') {
|
|||||||
// Common attributes
|
// Common attributes
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
|
||||||
|
|
||||||
|
if (!empty($conf->incoterm->enabled))
|
||||||
|
{
|
||||||
|
print '<tr>';
|
||||||
|
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->label_incoterms, 1).'</label></td>';
|
||||||
|
print '<td class="maxwidthonsmartphone">';
|
||||||
|
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms) ? $soc->location_incoterms : ''),'','fk_incoterms');
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
// Template to use by default
|
// Template to use by default
|
||||||
print '<tr><td>'.$langs->trans('DefaultModel').'</td>';
|
print '<tr><td>'.$langs->trans('DefaultModel').'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -626,6 +639,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$object->fields['fk_project']['visible']=0; // Already available in banner
|
$object->fields['fk_project']['visible']=0; // Already available in banner
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
|
|
||||||
|
// 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 ($permissiontoadd && $action != 'editincoterm') print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||||
|
else print ' ';
|
||||||
|
print '</td></tr></table>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td>';
|
||||||
|
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>';
|
||||||
|
}
|
||||||
|
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td>'.$langs->trans('EnhancedValue').' '.strtolower($langs->trans('TotalWoman'));
|
echo '<td>'.$langs->trans('EnhancedValue').' '.strtolower($langs->trans('TotalWoman'));
|
||||||
echo '<td>'.price($object->getValorisationTotale(), 0, '', 1, -1, -1, $conf->currency).'</td>';
|
echo '<td>'.price($object->getValorisationTotale(), 0, '', 1, -1, -1, $conf->currency).'</td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user