Merge branch 'develop' into scrutinizer-patch-2
This commit is contained in:
commit
88d2658625
@ -380,7 +380,7 @@ if (! empty($user->rights->produit->lire) || ! empty($user->rights->service->lir
|
|||||||
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromproduct')?'checked ':'').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
|
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromproduct')?'checked ':'').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<div class="showforproductselector">';
|
print '<div class="showforproductselector">';
|
||||||
$form->select_produits(GETPOST('productid'), 'productid', '');
|
$form->select_produits(GETPOST('productid'), 'productid', '', '', 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1);
|
||||||
print ' <input type="submit" id="submitproduct" name="submitproduct" class="button" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
print ' <input type="submit" id="submitproduct" name="submitproduct" class="button" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -265,6 +265,246 @@ class Categories extends DolibarrApi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link an object to a category by id
|
||||||
|
*
|
||||||
|
* @param int $id ID of category
|
||||||
|
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||||
|
* @param int $object_id ID of object
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws RestException
|
||||||
|
*
|
||||||
|
* @url POST {id}/objects/{type}/{object_id}
|
||||||
|
*/
|
||||||
|
public function linkObjectById($id, $type, $object_id)
|
||||||
|
{
|
||||||
|
if (empty($type) || empty($object_id)) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->category->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'category not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Add all types
|
||||||
|
if ($type === "product") {
|
||||||
|
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$object = new Product($this->db);
|
||||||
|
} else {
|
||||||
|
throw new RestException(401, "this type is not recognized yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($object)) {
|
||||||
|
$result = $object->fetch($object_id);
|
||||||
|
if ($result > 0) {
|
||||||
|
$result=$this->category->add_type($object, $type);
|
||||||
|
if ($result < 0) {
|
||||||
|
if ($this->category->error != 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||||
|
throw new RestException(500, 'Error when linking object', array_merge(array($this->category->error), $this->category->errors));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Objects succefully linked to the category'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link an object to a category by ref
|
||||||
|
*
|
||||||
|
* @param int $id ID of category
|
||||||
|
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||||
|
* @param string $object_ref Reference of object
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws RestException
|
||||||
|
*
|
||||||
|
* @url POST {id}/objects/{type}/ref/{object_ref}
|
||||||
|
*/
|
||||||
|
public function linkObjectByRef($id, $type, $object_ref)
|
||||||
|
{
|
||||||
|
if (empty($type) || empty($object_ref)) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->category->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'category not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Add all types
|
||||||
|
if ($type === "product") {
|
||||||
|
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$object = new Product($this->db);
|
||||||
|
} else {
|
||||||
|
throw new RestException(401, "this type is not recognized yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($object)) {
|
||||||
|
$result = $object->fetch('', $object_ref);
|
||||||
|
if ($result > 0) {
|
||||||
|
$result=$this->category->add_type($object, $type);
|
||||||
|
if ($result < 0) {
|
||||||
|
if ($this->category->error != 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||||
|
throw new RestException(500, 'Error when linking object', array_merge(array($this->category->error), $this->category->errors));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Objects succefully linked to the category'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unlink an object from a category by id
|
||||||
|
*
|
||||||
|
* @param int $id ID of category
|
||||||
|
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||||
|
* @param int $object_id ID of the object
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws RestException
|
||||||
|
*
|
||||||
|
* @url DELETE {id}/objects/{type}/{object_id}
|
||||||
|
*/
|
||||||
|
public function unlinkObjectById($id, $type, $object_id)
|
||||||
|
{
|
||||||
|
if (empty($type) || empty($object_id)) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->category->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'category not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Add all types
|
||||||
|
if ($type === "product") {
|
||||||
|
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$object = new Product($this->db);
|
||||||
|
} else {
|
||||||
|
throw new RestException(401, "this type is not recognized yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($object)) {
|
||||||
|
$result = $object->fetch((int) $object_id);
|
||||||
|
if ($result > 0) {
|
||||||
|
$result=$this->category->del_type($object, $type);
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(500, 'Error when unlinking object', array_merge(array($this->category->error), $this->category->errors));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Objects succefully unlinked from the category'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unlink an object from a category by ref
|
||||||
|
*
|
||||||
|
* @param int $id ID of category
|
||||||
|
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||||
|
* @param string $object_ref Reference of the object
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws RestException
|
||||||
|
*
|
||||||
|
* @url DELETE {id}/objects/{type}/ref/{object_ref}
|
||||||
|
*/
|
||||||
|
public function unlinkObjectByRef($id, $type, $object_ref)
|
||||||
|
{
|
||||||
|
if (empty($type) || empty($object_ref)) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->category->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'category not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Add all types
|
||||||
|
if ($type === "product") {
|
||||||
|
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$object = new Product($this->db);
|
||||||
|
} else {
|
||||||
|
throw new RestException(401, "this type is not recognized yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($object)) {
|
||||||
|
$result = $object->fetch('', (string) $object_ref);
|
||||||
|
if ($result > 0) {
|
||||||
|
$result=$this->category->del_type($object, $type);
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(500, 'Error when unlinking object', array_merge(array($this->category->error), $this->category->errors));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Objects succefully unlinked from the category'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
|
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
|
||||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||||
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -182,8 +183,8 @@ function showDirectPublicLink($object)
|
|||||||
/**
|
/**
|
||||||
* Generate a random id
|
* Generate a random id
|
||||||
*
|
*
|
||||||
* @param string $car Char to generate key
|
* @param int $car Length of string to generate key
|
||||||
* @return void
|
* @return string
|
||||||
*/
|
*/
|
||||||
function generate_random_id($car = 16)
|
function generate_random_id($car = 16)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -21,9 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
|
* \file htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php
|
||||||
* \ingroup agenda
|
* \ingroup agenda
|
||||||
* \brief Trigger file for agenda module
|
* \brief Trigger file for company - contactroles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||||
@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
|||||||
class InterfaceContactRoles extends DolibarrTriggers
|
class InterfaceContactRoles extends DolibarrTriggers
|
||||||
{
|
{
|
||||||
public $family = 'agenda';
|
public $family = 'agenda';
|
||||||
public $description = "Triggers of this module add actions in agenda according to setup made in agenda setup.";
|
public $description = "Triggers of this module auto link contact to company.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version of the trigger
|
* Version of the trigger
|
||||||
@ -73,7 +73,6 @@ class InterfaceContactRoles extends DolibarrTriggers
|
|||||||
$socid=(property_exists($object, 'socid')?$object->socid:$object->fk_soc);
|
$socid=(property_exists($object, 'socid')?$object->socid:$object->fk_soc);
|
||||||
|
|
||||||
if (! empty($socid) && $socid > 0) {
|
if (! empty($socid) && $socid > 0) {
|
||||||
global $db, $langs;
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
$contactdefault = new Contact($this->db);
|
$contactdefault = new Contact($this->db);
|
||||||
$contactdefault->socid=$socid;
|
$contactdefault->socid=$socid;
|
||||||
@ -83,7 +82,7 @@ class InterfaceContactRoles extends DolibarrTriggers
|
|||||||
if ($object->id > 0)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
$class = get_class($object);
|
$class = get_class($object);
|
||||||
$cloneFrom = new $class($db);
|
$cloneFrom = new $class($this->db);
|
||||||
$r = $cloneFrom->fetch($object->id);
|
$r = $cloneFrom->fetch($object->id);
|
||||||
|
|
||||||
if (!empty($cloneFrom->id)) $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal'));
|
if (!empty($cloneFrom->id)) $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal'));
|
||||||
|
|||||||
@ -125,7 +125,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
|||||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653);
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653);
|
||||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654);
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654);
|
||||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660);
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660);
|
||||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO disabled','Executed when a MO is produced','bom',661);
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661);
|
||||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662);
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662);
|
||||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663);
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663);
|
||||||
-- actions not enabled by default : they are excluded when we enable the module Agenda (except TASK_...)
|
-- actions not enabled by default : they are excluded when we enable the module Agenda (except TASK_...)
|
||||||
|
|||||||
@ -493,7 +493,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
|||||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654);
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654);
|
||||||
|
|
||||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660);
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660);
|
||||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO disabled','Executed when a MO is produced','bom',661);
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661);
|
||||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662);
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662);
|
||||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663);
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663);
|
||||||
|
|
||||||
|
|||||||
@ -390,7 +390,7 @@ if ($action == 'confirm_generateinvoice')
|
|||||||
|
|
||||||
// Define qty per hour
|
// Define qty per hour
|
||||||
$qtyhour = round($value['timespent'] / 3600, 2);
|
$qtyhour = round($value['timespent'] / 3600, 2);
|
||||||
$qtyhourtext = convertSecondToTime($value['timespent']);
|
$qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
|
||||||
|
|
||||||
// If no unit price known
|
// If no unit price known
|
||||||
if (empty($pu_ht))
|
if (empty($pu_ht))
|
||||||
|
|||||||
@ -231,7 +231,24 @@ if ($action == "change") // Change customer for TakePOS
|
|||||||
$idcustomer = GETPOST('idcustomer', 'int');
|
$idcustomer = GETPOST('idcustomer', 'int');
|
||||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||||
|
|
||||||
// @TODO Check if draft invoice already exists, if not create it or return a warning to ask to enter at least one line to have it created automatically
|
// Check if draft invoice already exists, if not create it
|
||||||
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")";
|
||||||
|
$result = $db->query($sql);
|
||||||
|
$num_lines = $db->num_rows($result);
|
||||||
|
if ($num_lines==0)
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
|
$invoice = new Facture($db);
|
||||||
|
$constforthirdpartyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
|
||||||
|
$invoice->socid = $conf->global->$constforthirdpartyid;
|
||||||
|
$invoice->date = dol_now();
|
||||||
|
$invoice->module_source = 'takepos';
|
||||||
|
$invoice->pos_source = $_SESSION["takeposterminal"];
|
||||||
|
$placeid =$invoice->create($user);
|
||||||
|
$sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid;
|
||||||
|
$db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1317,11 +1317,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
|||||||
{
|
{
|
||||||
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
|
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
|
||||||
if (! in_array($cpt->currency, $arrayzerounitcurrency)) {
|
if (! in_array($cpt->currency, $arrayzerounitcurrency)) {
|
||||||
$currencybalance[$cpt->currency]->available = $cpt->amount / 100;
|
$currencybalance[$cpt->currency]['available'] = $cpt->amount / 100;
|
||||||
} else {
|
} else {
|
||||||
$currencybalance[$cpt->currency]->available = $cpt->amount;
|
$currencybalance[$cpt->currency]['available'] = $cpt->amount;
|
||||||
}
|
}
|
||||||
$currencybalance[$cpt->currency]->currency = $cpt->currency;
|
$currencybalance[$cpt->currency]['currency'] = $cpt->currency;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1331,9 +1331,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
|||||||
{
|
{
|
||||||
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
|
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
|
||||||
if (! in_array($cpt->currency, $arrayzerounitcurrency)) {
|
if (! in_array($cpt->currency, $arrayzerounitcurrency)) {
|
||||||
$currencybalance[$cpt->currency]->pending = $currencybalance[$cpt->currency]->available + $cpt->amount / 100;
|
$currencybalance[$cpt->currency]['pending'] = $currencybalance[$cpt->currency]['available']+$cpt->amount / 100;
|
||||||
} else {
|
} else {
|
||||||
$currencybalance[$cpt->currency]->pending = $currencybalance[$cpt->currency]->available + $cpt->amount;
|
$currencybalance[$cpt->currency]['pending'] = $currencybalance[$cpt->currency]['available']+$cpt->amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1342,7 +1342,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
|||||||
{
|
{
|
||||||
foreach ($currencybalance as $cpt)
|
foreach ($currencybalance as $cpt)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Currency".strtoupper($cpt->currency)).'</td><td>'.price($cpt->available, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'</td><td>'.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'</td><td>'.price($cpt->available + $cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Currency".strtoupper($cpt['currency'])).'</td><td>'.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td><td>'.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td><td>'.price($cpt['available']+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2018 Jean-François Ferry <hello@librethic.io>
|
/* Copyright (C) 2013-2018 Jean-François Ferry <hello@librethic.io>
|
||||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||||
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -120,7 +121,7 @@ class Ticket extends CommonObject
|
|||||||
public $progress;
|
public $progress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Duration for ticket
|
* @var string Duration for ticket
|
||||||
*/
|
*/
|
||||||
public $timing;
|
public $timing;
|
||||||
|
|
||||||
@ -250,11 +251,11 @@ class Ticket extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->fk_soc)) {
|
if (isset($this->fk_soc)) {
|
||||||
$this->fk_soc = trim($this->fk_soc);
|
$this->fk_soc = (int) $this->fk_soc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->fk_project)) {
|
if (isset($this->fk_project)) {
|
||||||
$this->fk_project = trim($this->fk_project);
|
$this->fk_project = (int) $this->fk_project;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->origin_email)) {
|
if (isset($this->origin_email)) {
|
||||||
@ -262,11 +263,11 @@ class Ticket extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->fk_user_create)) {
|
if (isset($this->fk_user_create)) {
|
||||||
$this->fk_user_create = trim($this->fk_user_create);
|
$this->fk_user_create = (int) $this->fk_user_create;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->fk_user_assign)) {
|
if (isset($this->fk_user_assign)) {
|
||||||
$this->fk_user_assign = trim($this->fk_user_assign);
|
$this->fk_user_assign = (int) $this->fk_user_assign;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->subject)) {
|
if (isset($this->subject)) {
|
||||||
@ -278,7 +279,7 @@ class Ticket extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->fk_statut)) {
|
if (isset($this->fk_statut)) {
|
||||||
$this->fk_statut = trim($this->fk_statut);
|
$this->fk_statut = (int) $this->fk_statut;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->resolution)) {
|
if (isset($this->resolution)) {
|
||||||
@ -746,11 +747,11 @@ class Ticket extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->fk_soc)) {
|
if (isset($this->fk_soc)) {
|
||||||
$this->fk_soc = trim($this->fk_soc);
|
$this->fk_soc = (int) $this->fk_soc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->fk_project)) {
|
if (isset($this->fk_project)) {
|
||||||
$this->fk_project = trim($this->fk_project);
|
$this->fk_project = (int) $this->fk_project;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->origin_email)) {
|
if (isset($this->origin_email)) {
|
||||||
@ -758,11 +759,11 @@ class Ticket extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->fk_user_create)) {
|
if (isset($this->fk_user_create)) {
|
||||||
$this->fk_user_create = trim($this->fk_user_create);
|
$this->fk_user_create = (int) $this->fk_user_create;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->fk_user_assign)) {
|
if (isset($this->fk_user_assign)) {
|
||||||
$this->fk_user_assign = trim($this->fk_user_assign);
|
$this->fk_user_assign = (int) $this->fk_user_assign;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->subject)) {
|
if (isset($this->subject)) {
|
||||||
@ -774,7 +775,7 @@ class Ticket extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->fk_statut)) {
|
if (isset($this->fk_statut)) {
|
||||||
$this->fk_statut = trim($this->fk_statut);
|
$this->fk_statut = (int) $this->fk_statut;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->resolution)) {
|
if (isset($this->resolution)) {
|
||||||
@ -1002,12 +1003,12 @@ class Ticket extends CommonObject
|
|||||||
$this->ref = 'TI0501-001';
|
$this->ref = 'TI0501-001';
|
||||||
$this->track_id = 'XXXXaaaa';
|
$this->track_id = 'XXXXaaaa';
|
||||||
$this->origin_email = 'email@email.com';
|
$this->origin_email = 'email@email.com';
|
||||||
$this->fk_project = '1';
|
$this->fk_project = 1;
|
||||||
$this->fk_user_create = '1';
|
$this->fk_user_create = 1;
|
||||||
$this->fk_user_assign = '1';
|
$this->fk_user_assign = 1;
|
||||||
$this->subject = 'Subject of ticket';
|
$this->subject = 'Subject of ticket';
|
||||||
$this->message = 'Message of ticket';
|
$this->message = 'Message of ticket';
|
||||||
$this->fk_statut = '0';
|
$this->fk_statut = 0;
|
||||||
$this->resolution = '1';
|
$this->resolution = '1';
|
||||||
$this->progress = '10';
|
$this->progress = '10';
|
||||||
$this->timing = '30';
|
$this->timing = '30';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user