FIX : travis feedbacks

This commit is contained in:
Gauthier PC portable 024 2021-07-30 14:17:36 +02:00
parent 3c71784272
commit 846f0366d3
7 changed files with 39 additions and 29 deletions

View File

@ -122,10 +122,7 @@ if ($action == 'updateMask') {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} } elseif ($action == 'set') { // Activate a model
// Activate a model
elseif ($action == 'set') {
$ret = addDocumentModel($value, 'stocktransfer', $label, $scandir); $ret = addDocumentModel($value, 'stocktransfer', $label, $scandir);
} elseif ($action == 'del') { } elseif ($action == 'del') {
$tmpobjectkey = GETPOST('object'); $tmpobjectkey = GETPOST('object');
@ -135,10 +132,7 @@ elseif ($action == 'set') {
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF'; $constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity); if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity);
} }
} } elseif ($action == 'setdoc') { // Set default model
// Set default model
elseif ($action == 'setdoc') {
$tmpobjectkey = GETPOST('object'); $tmpobjectkey = GETPOST('object');
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF'; $constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {

View File

@ -500,9 +500,12 @@ class modStockTransfer extends DolibarrModules
return $this->_init($sql, $options); return $this->_init($sql, $options);
} }
/**
* Returns next available id to insert new roles in llx_c_type_contact
* @return int > 0 if OK, < 0 if KO
*/
function getNextId() function getNextId()
{ {
global $db; global $db;
// Get free id for insert // Get free id for insert
@ -514,6 +517,7 @@ class modStockTransfer extends DolibarrModules
$newid = ($obj->newid + 1); $newid = ($obj->newid + 1);
} else { } else {
dol_print_error($db); dol_print_error($db);
return -1;
} }
return $newid; return $newid;
} }

View File

@ -824,6 +824,12 @@ class pdf_eagle extends ModelePdfStockTransfer
}*/ }*/
} }
/**
* Used to know if at least one line of Stock Transfer object has a batch set
*
* @param $object Stock Transfer object
* @return bool true if at least one line has batch set, false if not
*/
function atLeastOneBatch($object) function atLeastOneBatch($object)
{ {

View File

@ -347,6 +347,13 @@ class StockTransfer extends CommonObject
return $result; return $result;
} }
/**
* Used to sort lines by rank
*
* @param $a 1st element to test
* @param $b 1st element to test
* @return int
*/
function cmp($a, $b) function cmp($a, $b)
{ {
if ($a->rang == $b->rang) { if ($a->rang == $b->rang) {
@ -355,6 +362,11 @@ class StockTransfer extends CommonObject
return ($a->rang < $b->rang) ? -1 : 1; return ($a->rang < $b->rang) ? -1 : 1;
} }
/**
* Used to get total PMP amount of all quantities of products of Stock Transfer
*
* @return float total amount of Stock Transfer
*/
function getValorisationTotale() function getValorisationTotale()
{ {

View File

@ -435,6 +435,14 @@ class StockTransferLine extends CommonObject
return $this->deleteLineCommon($user, $idline, $notrigger); return $this->deleteLineCommon($user, $idline, $notrigger);
} }
/**
* Makes all stock movements (add quantity, remove quantity or cancel all actions)
*
* @param string $label label of stock movement
* @param int $fk_entrepot Warehouse concerned by stock movement
* @param int $direction add or remove qty
* @return int 1 if ok, <= 0 if ko
*/
function doStockMovement($label, $fk_entrepot, $direction = 1) function doStockMovement($label, $fk_entrepot, $direction = 1)
{ {

View File

@ -494,30 +494,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Create an array for form // Create an array for form
$formquestion = array(); $formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
} } elseif ($action == 'destock') { // Destock confirmation
// Destock confirmation
elseif ($action == 'destock') {
// Create an array for form // Create an array for form
$formquestion = array( 'text' => '', $formquestion = array( 'text' => '',
array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestock', $object->ref), 'size'=>40)); array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestock', $object->ref), 'size'=>40));
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DestockAllProduct'), '', 'confirm_destock', $formquestion, 'yes', 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DestockAllProduct'), '', 'confirm_destock', $formquestion, 'yes', 1);
} } elseif ($action == 'destockcancel') { // Destock confirmation cancel
// Destock confirmation cancel
elseif ($action == 'destockcancel') {
// Create an array for form // Create an array for form
$formquestion = array( 'text' => '', $formquestion = array( 'text' => '',
array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestockCancel', $object->ref), 'size'=>40)); array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestockCancel', $object->ref), 'size'=>40));
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DestockAllProductCancel'), '', 'confirm_destockcancel', $formquestion, 'yes', 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DestockAllProductCancel'), '', 'confirm_destockcancel', $formquestion, 'yes', 1);
} } elseif ($action == 'addstock') { // Addstock confirmation
// Addstock confirmation
elseif ($action == 'addstock') {
// Create an array for form // Create an array for form
$formquestion = array( 'text' => '', $formquestion = array( 'text' => '',
array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").'&nbsp;:', 'value' => $langs->trans('ConfirmAddStock', $object->ref), 'size'=>40)); array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").'&nbsp;:', 'value' => $langs->trans('ConfirmAddStock', $object->ref), 'size'=>40));
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('AddStockAllProduct'), '', 'confirm_addstock', $formquestion, 'yes', 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('AddStockAllProduct'), '', 'confirm_addstock', $formquestion, 'yes', 1);
} } elseif ($action == 'addstockcancel') { // Addstock confirmation cancel
// Addstock confirmation cancel
elseif ($action == 'addstockcancel') {
// Create an array for form // Create an array for form
$formquestion = array( 'text' => '', $formquestion = array( 'text' => '',
array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").'&nbsp;:', 'value' => $langs->trans('ConfirmAddStockCancel', $object->ref), 'size'=>40)); array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").'&nbsp;:', 'value' => $langs->trans('ConfirmAddStockCancel', $object->ref), 'size'=>40));

View File

@ -92,17 +92,11 @@ if ($action == 'addcontact' && $user->rights->stocktransfer->stocktransfer->writ
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} } elseif ($action == 'swapstatut' && $user->rights->stocktransfer->stocktransfer->write) { // Toggle the status of a contact
// Toggle the status of a contact
elseif ($action == 'swapstatut' && $user->rights->stocktransfer->stocktransfer->write) {
if ($object->id > 0) { if ($object->id > 0) {
$result = $object->swapContactStatus(GETPOST('ligne')); $result = $object->swapContactStatus(GETPOST('ligne'));
} }
} } elseif ($action == 'deletecontact' && $user->rights->stocktransfer->stocktransfer->write) { // Deletes a contact
// Deletes a contact
elseif ($action == 'deletecontact' && $user->rights->stocktransfer->stocktransfer->write) {
$result = $object->delete_contact($lineid); $result = $object->delete_contact($lineid);
if ($result >= 0) { if ($result >= 0) {