Hi,
I´ve resolve my own issue
Hope this will be useful for other that uses Calem Community.
I have printed "//Adjusted by CHNO" where the changes are.
This is the adjusted source code in CalemInTranBo.php:
/**
* Physical counting transaction (both part and tool are the same)
* @param in_id - item id
* @param location_id - stock location id
* @param qty - qty to set to
* @param costcode_id - costcode
* @param note - note
* @param tran_time - time transaction happened
* @param tran_user_id - who did the counting
* @param store_user_id - staff performed the transaction
*
*/
public function physical($tran, $rollback=false) {
if ($this->logger->isInfoEnabled()) $this->logger->info("Physical transaction: " . var_export($tran, true));
//Adjusted by CHNO, accept quantity = 0 in transaction table
if ($tran['qty']<0) return;
//Get valuation handler to find out unit cost
$inDbo=CalemFactory::getDbo("inventory");
$in=$inDbo->fetchById($tran['in_id']);
try {
//Now starts a transaction
$inDbo->beginTransaction();
//Lock inventory table first
$inDbo->executeBySqlParam('select id from inventory where id=? for update', $tran['in_id']);
//Update stock level
$oldQty= $this->_setStock($inDbo, $tran['in_id'], $tran['location_id'], $tran['qty']);
//Add inTransaction
$inTranDbo=CalemFactory::getDbo('in_tran');
$it['in_id']=$tran['in_id'];
$it['type_id']= 'itt_physical';
$it['location_id']=$tran['location_id'];
//Adjusted by CHNO, if the user print 0 accept 0 and put it in transaction table
if ($tran['qty']==0){
$it['qty']=0;
}else{
$it['qty']=$tran['qty'];
}
$it['qty_orig']=$oldQty;
$it['costcode_id']=isset($tran['costcode_id']) ? $tran['costcode_id'] : null;
$it['note']=isset($tran['note'])? $tran['note'] : null;
$it['tran_time']=$tran['tran_time'];
$it['tran_user_id']=isset($tran['tran_user_id']) ? $tran['tran_user_id'] : null;
$it['store_user_id']=isset($tran['store_user_id']) ? $tran['store_user_id'] : null;
//Generating a unique id
$it['id']=$inTranDbo->getUid();
$inTranDbo->setChangeBulk($it);
$inTranDbo->insert();
//Notify transactions
$this->notify($this->conf['physical']['notifier_list'], $it);
//Review order, etc.
$this->inBo->onInStockLevelChanged($tran['in_id'], $inDbo);
//Commit transaction
$inDbo->commit();
return $it;
}catch (Exception $ex) {
if ($rollback) $inDbo->rollback();
$this->logger->error('Error in check out transaction: ' . $ex->getMessage() . ', tran=' . var_export($tran, true));
throw $ex;
}
}