commit
39229a0b22
@ -12,13 +12,13 @@ jobs:
|
||||
- uses: Dolibarr/stale@master
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. Without comment, this issue will be closed automatically by stale bot in 15 days.'
|
||||
stale-issue-message: 'This issue is stale because it has been open 6 month with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue will be closed automatically by stale bot in 6 month.'
|
||||
stale-issue-label: 'Issue Stale (automatic label)'
|
||||
exempt-issue-label: 'Priority High / Blocking'
|
||||
days-before-stale: 365
|
||||
days-before-close: 15
|
||||
days-before-stale: 182
|
||||
days-before-close: 183
|
||||
operations-per-run: 50
|
||||
#stale-pr-message: 'This PR is stale because it has been open 1 year with no activity. If this PR is still mergeable (no conflict, nor Continuous Integration errors), please comment to confirm this merge is still expected. Without comment, this issue will be closed automatically by stale bot in 15 days.'
|
||||
#stale-pr-message: 'This PR is stale because it has been open 6 month with no activity. If this PR is still mergeable (no conflict, nor Continuous Integration errors), please comment to confirm this merge is still expected. Without comment, this issue will be closed automatically by stale bot in 6 month.'
|
||||
stale-pr-label: 'PR Stale (automatic label)'
|
||||
stale-pr-message:
|
||||
exempt-pr-label: 'Priority Top Strategic'
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -40,3 +40,4 @@ htdocs/includes/sebastian/
|
||||
htdocs/includes/squizlabs/
|
||||
htdocs/includes/symfony/
|
||||
htdocs/includes/webmozart/
|
||||
htdocs/.well-known/apple-developer-merchantid-domain-association
|
||||
|
||||
@ -271,7 +271,7 @@ if ($action != 'export_csv')
|
||||
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte";
|
||||
$resql = $db->query($sql);
|
||||
$nrows = $resql->num_rows;
|
||||
$opening_balances = Array();
|
||||
$opening_balances = array();
|
||||
for ($i = 0; $i < $nrows; $i++) {
|
||||
$arr = $resql->fetch_array();
|
||||
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
|
||||
|
||||
@ -204,7 +204,7 @@ if ($conf->use_javascript_ajax)
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, $badgeStatus6, '-'.$badgeStatus0));
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
|
||||
@ -156,7 +156,6 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_SHOW_LOGO", GETPOST("MAIN_SHOW_LOGO", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
|
||||
@ -109,22 +109,21 @@ class Proposals extends DolibarrApi
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param int $id ID of order
|
||||
* @param int $id ID of order
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other objec
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1)
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id, $ref, $ref_ext, $ref_int);
|
||||
$result = $this->propal->fetch($id, $ref, $ref_ext);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
@ -254,56 +254,56 @@ class Propal extends CommonObject
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>15),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>45), // deprecated
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>35, 'index'=>1),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>40),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'datep' =>array('type'=>'date', 'label'=>'Datep', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'fin_validite' =>array('type'=>'datetime', 'label'=>'Fin validite', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'fin_validite' =>array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'Date cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>85),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||
'price' =>array('type'=>'double', 'label'=>'Price', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'Remise absolue', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'Tva', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
||||
'total' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Fk currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'total' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>180),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'Date livraison', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'Fk shipping method', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Fk availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'Fk delivery address', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'Fk input reason', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'Fk incoterms', 'enabled'=>1, 'visible'=>-1, 'position'=>220),
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'Location incoterms', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
|
||||
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>230),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>235),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>240),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>245),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>250),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>255),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>260),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>220),
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>225),
|
||||
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>230),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>235),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>240, 'isameasure'=>1),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>245, 'isameasure'=>1),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>250, 'isameasure'=>1),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>255, 'isameasure'=>1),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>260),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
@ -1453,9 +1453,10 @@ class Propal extends CommonObject
|
||||
*
|
||||
* @param int $rowid id of object to load
|
||||
* @param string $ref Ref of proposal
|
||||
* @param string $ref_ext Ref ext of proposal
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function fetch($rowid, $ref = '')
|
||||
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";
|
||||
|
||||
@ -210,10 +210,11 @@ class PropaleStats extends Stats
|
||||
/**
|
||||
* Return nb, amount of predefined product for year
|
||||
*
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
* @param int $year Year to scan
|
||||
* @param int $limit Limit
|
||||
* @return array Array of values
|
||||
*/
|
||||
public function getAllByProduct($year)
|
||||
public function getAllByProduct($year, $limit = 10)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@ -227,6 +228,6 @@ class PropaleStats extends Stats
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql);
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ if ($resql)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
|
||||
@ -1165,9 +1165,7 @@ if ($resql)
|
||||
$nbofsalesrepresentative = count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) // We print only number
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$companystatic->id.'">';
|
||||
print $nbofsalesrepresentative;
|
||||
print '</a>';
|
||||
}
|
||||
elseif ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
|
||||
@ -111,19 +111,18 @@ class Orders extends DolibarrApi
|
||||
* @param int $id ID of order
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other objec
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1)
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id, $ref, $ref_ext, $ref_int);
|
||||
$result = $this->commande->fetch($id, $ref, $ref_ext);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
@ -101,6 +101,7 @@ class Commande extends CommonOrder
|
||||
|
||||
/**
|
||||
* @var string Internal ref for order
|
||||
* @deprecated
|
||||
*/
|
||||
public $ref_int;
|
||||
|
||||
@ -263,60 +264,60 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>35, 'index'=>1),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>40),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
|
||||
'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>56),
|
||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'Date cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'date_commande' =>array('type'=>'date', 'label'=>'Date commande', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>80),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||
'amount_ht' =>array('type'=>'double(24,8)', 'label'=>'Amount ht', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'Remise absolue', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'Tva', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
|
||||
//'amount_ht' =>array('type'=>'double(24,8)', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>150),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||
'facture' =>array('type'=>'tinyint(4)', 'label'=>'Facture', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Fk currency', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'Date livraison', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'Fk shipping method', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Fk availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'Fk input reason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
|
||||
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'Fk delivery address', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
|
||||
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'Fk incoterms', 'enabled'=>1, 'visible'=>-1, 'position'=>230),
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'Location incoterms', 'enabled'=>1, 'visible'=>-1, 'position'=>235),
|
||||
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>240),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>245),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>250),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>255),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>260),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>265),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>270),
|
||||
'module_source' =>array('type'=>'varchar(32)', 'label'=>'Module source', 'enabled'=>1, 'visible'=>-1, 'position'=>275),
|
||||
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'Pos source', 'enabled'=>1, 'visible'=>-1, 'position'=>280),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>230),
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>235),
|
||||
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>240),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>245),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>250, 'isameasure'=>1),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>255, 'isameasure'=>1),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>260, 'isameasure'=>1),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>265, 'isameasure'=>1),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270),
|
||||
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>275),
|
||||
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
@ -1773,13 +1774,13 @@ class Commande extends CommonOrder
|
||||
* @param int $id Id of object to load
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other object
|
||||
* @param string $notused Internal reference of other object
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
*/
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $notused = '')
|
||||
{
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
|
||||
|
||||
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
|
||||
$sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
|
||||
@ -1810,7 +1811,7 @@ class Commande extends CommonOrder
|
||||
|
||||
if ($ref) $sql .= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql .= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql .= " AND c.ref_int='".$this->db->escape($ref_int)."'";
|
||||
if ($notused) $sql .= " AND c.ref_int='".$this->db->escape($notused)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -203,10 +203,11 @@ class CommandeStats extends Stats
|
||||
/**
|
||||
* Return nb, amount of predefined product for year
|
||||
*
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
* @param int $year Year to scan
|
||||
* @param int $limit Limit
|
||||
* @return array Array of values
|
||||
*/
|
||||
public function getAllByProduct($year)
|
||||
public function getAllByProduct($year, $limit = 10)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@ -220,6 +221,6 @@ class CommandeStats extends Stats
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql);
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ if ($resql)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
|
||||
@ -115,10 +115,10 @@ if ($conf->use_javascript_ajax)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($totalnb?0:1);
|
||||
|
||||
|
||||
@ -111,19 +111,18 @@ class Invoices extends DolibarrApi
|
||||
* @param int $id ID of order
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other objec
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1)
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->facture->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id, $ref, $ref_ext, $ref_int);
|
||||
$result = $this->invoice->fetch($id, $ref, $ref_ext);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
@ -112,7 +112,13 @@ class Facture extends CommonInvoice
|
||||
public $date; // Date invoice
|
||||
public $datem;
|
||||
public $ref_client;
|
||||
public $ref_int;
|
||||
|
||||
/**
|
||||
* @var int Ref Int
|
||||
* @deprecated
|
||||
*/
|
||||
public $ref_int; // deprecated
|
||||
|
||||
//Check constants for types
|
||||
public $type = self::TYPE_STANDARD;
|
||||
|
||||
@ -255,10 +261,10 @@ class Facture extends CommonInvoice
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>25),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30), // deprecated
|
||||
'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||
'increment' =>array('type'=>'varchar(10)', 'label'=>'Increment', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
//'increment' =>array('type'=>'varchar(10)', 'label'=>'Increment', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>50),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'datef' =>array('type'=>'date', 'label'=>'DateInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
@ -267,18 +273,17 @@ class Facture extends CommonInvoice
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>75),
|
||||
'paye' =>array('type'=>'smallint(6)', 'label'=>'InvoicePaidCompletely', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>80),
|
||||
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'Remise absolue', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
'close_code' =>array('type'=>'varchar(16)', 'label'=>'EarlyClosingReason', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'close_note' =>array('type'=>'varchar(128)', 'label'=>'EarlyClosingComment', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'TotalVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
|
||||
'total' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Paid', 3=>'Abandonned')),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>155),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
@ -300,20 +305,21 @@ class Facture extends CommonInvoice
|
||||
'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>245),
|
||||
'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>250),
|
||||
'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>255),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermsCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>260),
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermsLocation', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>260),
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265),
|
||||
'date_pointoftax' =>array('type'=>'date', 'label'=>'DatePointOfTax', 'enabled'=>'$conf->global->INVOICE_POINTOFTAX_DATE', 'visible'=>-1, 'position'=>270),
|
||||
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'MulticurrencyID', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>275),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCode', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>280),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>285),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>290),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>295),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>300),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>280),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>285, 'isameasure'=>1),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>290, 'isameasure'=>1),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>295, 'isameasure'=>1),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>300, 'isameasure'=>1),
|
||||
'fk_fac_rec_source' =>array('type'=>'integer', 'label'=>'RecurringInvoiceSource', 'enabled'=>1, 'visible'=>-1, 'position'=>305),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>310),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>310),
|
||||
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>315),
|
||||
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>320),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>220),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Paid', 3=>'Abandonned')),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
@ -1450,18 +1456,18 @@ class Facture extends CommonInvoice
|
||||
/**
|
||||
* Get object from database. Get also lines.
|
||||
*
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref Reference of invoice
|
||||
* @param string $ref_ext External reference of invoice
|
||||
* @param int $ref_int Internal reference of other object
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref Reference of invoice
|
||||
* @param string $ref_ext External reference of invoice
|
||||
* @param int $notused Not used
|
||||
* @param bool $fetch_situation Fetch the previous and next situation in $tab_previous_situation_invoice and $tab_next_situation_invoice
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
*/
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $fetch_situation = false)
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '', $notused = '', $fetch_situation = false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
if (empty($rowid) && empty($ref) && empty($ref_ext)) return -1;
|
||||
|
||||
$sql = 'SELECT f.rowid,f.entity,f.ref,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc';
|
||||
$sql .= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
|
||||
@ -1493,7 +1499,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; // Dont't use entity if you use rowid
|
||||
if ($ref) $sql .= " AND f.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql .= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql .= " AND f.ref_int='".$this->db->escape($ref_int)."'";
|
||||
if ($notused) $sql .= " AND f.ref_int='".$this->db->escape($notused)."'"; // deprecated
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
|
||||
@ -205,10 +205,11 @@ class FactureStats extends Stats
|
||||
/**
|
||||
* Return nb, amount of predefined product for year
|
||||
*
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
* @param int $year Year to scan
|
||||
* @param int $limit Limit
|
||||
* @return array Array of values
|
||||
*/
|
||||
public function getAllByProduct($year)
|
||||
public function getAllByProduct($year, $limit = 10)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@ -222,6 +223,6 @@ class FactureStats extends Stats
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql);
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,7 +225,6 @@ class Contrat extends CommonObject
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
@ -239,6 +238,7 @@ class Contrat extends CommonObject
|
||||
'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'Ref customer', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
||||
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed'))
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
@ -209,7 +209,7 @@ if (!empty($conf->use_javascript_ajax))
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
|
||||
@ -705,9 +705,7 @@ while ($i < min($num, $limit))
|
||||
$nbofsalesrepresentative = count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) {
|
||||
// We print only number
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$socstatic->id.'">';
|
||||
print $nbofsalesrepresentative;
|
||||
print '</a>';
|
||||
}
|
||||
elseif ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
|
||||
@ -75,6 +75,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$this->max = $max;
|
||||
$dir = $conf->user->dir_temp;
|
||||
|
||||
$refreshaction = 'refresh_'.$this->boxcode;
|
||||
|
||||
@ -145,7 +146,8 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$showpointvalue = 1; $nocolor = 0;
|
||||
$mode = 'customer';
|
||||
$stats_invoice = new FactureStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0));
|
||||
$data1 = $stats_invoice->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)));
|
||||
$data1 = $stats_invoice->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
|
||||
|
||||
if (empty($data1))
|
||||
{
|
||||
$showpointvalue = 0;
|
||||
@ -159,11 +161,12 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (!$mesg)
|
||||
{
|
||||
$i = 0; $tot = count($data1); $legend = array();
|
||||
while ($i <= $tot)
|
||||
$i = 0; $legend = array();
|
||||
|
||||
foreach($data1 as $key => $val)
|
||||
{
|
||||
$data1[$i][0] = dol_trunc($data1[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[] = $data1[$i][0];
|
||||
$data1[$key][0] = dol_trunc($data1[$key][0], 32);
|
||||
$legend[] = $data1[$key][0];
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -172,11 +175,11 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
|
||||
if ($nocolor) $px1->SetDataColor(array(array(220, 220, 220)));
|
||||
$px1->SetLegend($legend);
|
||||
$px1->setShowLegend(0);
|
||||
$px1->setShowLegend(2);
|
||||
$px1->setShowPointValue($showpointvalue);
|
||||
$px1->setShowPercent(0);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||
$px1->SetWidth($WIDTH);
|
||||
//$px1->SetWidth($WIDTH);
|
||||
$px1->SetHeight($HEIGHT);
|
||||
//$px1->SetYLabel($langs->trans("NumberOfBills"));
|
||||
$px1->SetShading(3);
|
||||
@ -202,7 +205,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
|
||||
$showpointvalue = 1; $nocolor = 0;
|
||||
$stats_proposal = new PropaleStats($this->db, $socid, ($userid > 0 ? $userid : 0));
|
||||
$data2 = $stats_proposal->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)));
|
||||
$data2 = $stats_proposal->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
|
||||
if (empty($data2))
|
||||
{
|
||||
$showpointvalue = 0;
|
||||
@ -217,11 +220,12 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (!$mesg)
|
||||
{
|
||||
$i = 0; $tot = count($data2); $legend = array();
|
||||
while ($i <= $tot)
|
||||
$i = 0; $legend = array();
|
||||
|
||||
foreach($data2 as $key => $val)
|
||||
{
|
||||
$data2[$i][0] = dol_trunc($data2[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[] = $data2[$i][0];
|
||||
$data2[$key][0] = dol_trunc($data2[$key][0], 32);
|
||||
$legend[] = $data2[$key][0];
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -230,11 +234,11 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
|
||||
if ($nocolor) $px2->SetDataColor(array(array(220, 220, 220)));
|
||||
$px2->SetLegend($legend);
|
||||
$px2->setShowLegend(0);
|
||||
$px2->setShowLegend(2);
|
||||
$px2->setShowPointValue($showpointvalue);
|
||||
$px2->setShowPercent(0);
|
||||
$px2->SetMaxValue($px2->GetCeilMaxValue());
|
||||
$px2->SetWidth($WIDTH);
|
||||
//$px2->SetWidth($WIDTH);
|
||||
$px2->SetHeight($HEIGHT);
|
||||
//$px2->SetYLabel($langs->trans("AmountOfBillsHT"));
|
||||
$px2->SetShading(3);
|
||||
@ -261,7 +265,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$showpointvalue = 1; $nocolor = 0;
|
||||
$mode = 'customer';
|
||||
$stats_order = new CommandeStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0));
|
||||
$data3 = $stats_order->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)));
|
||||
$data3 = $stats_order->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
|
||||
if (empty($data3))
|
||||
{
|
||||
$showpointvalue = 0;
|
||||
@ -276,11 +280,12 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$mesg = $px3->isGraphKo();
|
||||
if (!$mesg)
|
||||
{
|
||||
$i = 0; $tot = count($data3); $legend = array();
|
||||
while ($i <= $tot)
|
||||
$i = 0; $legend = array();
|
||||
|
||||
foreach($data3 as $key => $val)
|
||||
{
|
||||
$data3[$i][0] = dol_trunc($data3[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[] = $data3[$i][0];
|
||||
$data3[$key][0] = dol_trunc($data3[$key][0], 32);
|
||||
$legend[] = $data3[$key][0];
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -289,11 +294,11 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
|
||||
if ($nocolor) $px3->SetDataColor(array(array(220, 220, 220)));
|
||||
$px3->SetLegend($legend);
|
||||
$px3->setShowLegend(0);
|
||||
$px3->setShowLegend(2);
|
||||
$px3->setShowPointValue($showpointvalue);
|
||||
$px3->setShowPercent(0);
|
||||
$px3->SetMaxValue($px3->GetCeilMaxValue());
|
||||
$px3->SetWidth($WIDTH);
|
||||
//$px3->SetWidth($WIDTH);
|
||||
$px3->SetHeight($HEIGHT);
|
||||
//$px3->SetYLabel($langs->trans("AmountOfBillsHT"));
|
||||
$px3->SetShading(3);
|
||||
|
||||
@ -568,12 +568,12 @@ abstract class CommonDocGenerator
|
||||
'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs),
|
||||
'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs),
|
||||
// Dates
|
||||
'line_date_start'=>dol_print_date($line->date_start, 'day', 'tzuser'),
|
||||
'line_date_start_locale'=>dol_print_date($line->date_start, 'day', 'tzuser', $outputlangs),
|
||||
'line_date_start_rfc'=>dol_print_date($line->date_start, 'dayrfc', 'tzuser'),
|
||||
'line_date_end'=>dol_print_date($line->date_end, 'day', 'tzuser'),
|
||||
'line_date_end_locale'=>dol_print_date($line->date_end, 'day', 'tzuser', $outputlangs),
|
||||
'line_date_end_rfc'=>dol_print_date($line->date_end, 'dayrfc', 'tzuser'),
|
||||
'line_date_start'=>dol_print_date($line->date_start, 'day'),
|
||||
'line_date_start_locale'=>dol_print_date($line->date_start, 'day', 'tzserver', $outputlangs),
|
||||
'line_date_start_rfc'=>dol_print_date($line->date_start, 'dayrfc'),
|
||||
'line_date_end'=>dol_print_date($line->date_end, 'day'),
|
||||
'line_date_end_locale'=>dol_print_date($line->date_end, 'day', 'tzserver', $outputlangs),
|
||||
'line_date_end_rfc'=>dol_print_date($line->date_end, 'dayrfc'),
|
||||
|
||||
'line_multicurrency_code' => price2num($line->multicurrency_code),
|
||||
'line_multicurrency_subprice' => price2num($line->multicurrency_subprice),
|
||||
|
||||
@ -5420,7 +5420,7 @@ abstract class CommonObject
|
||||
// Add field of attribute
|
||||
if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] != 'separate') // Only for other type than separator)
|
||||
{
|
||||
if ($new_array_options[$key] != '')
|
||||
if ($new_array_options[$key] != '' || $new_array_options[$key] == '0')
|
||||
{
|
||||
$sql .= ",'".$this->db->escape($new_array_options[$key])."'";
|
||||
}
|
||||
@ -5522,7 +5522,7 @@ abstract class CommonObject
|
||||
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
|
||||
return -1;
|
||||
}
|
||||
elseif ($value == '')
|
||||
elseif ($value === '')
|
||||
{
|
||||
$this->array_options["options_".$key] = null;
|
||||
}
|
||||
@ -5535,7 +5535,7 @@ abstract class CommonObject
|
||||
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
|
||||
return -1;
|
||||
}
|
||||
elseif ($value == '')
|
||||
elseif ($value === '')
|
||||
{
|
||||
$this->array_options["options_".$key] = null;
|
||||
}
|
||||
|
||||
@ -683,7 +683,7 @@ class Conf
|
||||
|
||||
if (!isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 0;
|
||||
|
||||
if (!isset($conf->global->MAIN_JS_GRAPH)) $conf->global->MAIN_JS_GRAPH = 'chart'; // Use chart.js library
|
||||
if (!isset($this->global->MAIN_JS_GRAPH)) $this->global->MAIN_JS_GRAPH = 'chart'; // Use chart.js library
|
||||
|
||||
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com';
|
||||
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567';
|
||||
|
||||
@ -30,10 +30,10 @@
|
||||
* $dolgraph->SetTitle($langs->transnoentities('MyTitle').'<br>'.$langs->transnoentities('MyTitlePercent').'%');
|
||||
* $dolgraph->SetMaxValue(50);
|
||||
* $dolgraph->SetData($data);
|
||||
* $dolgraph->setShowLegend(1);
|
||||
* $dolgraph->setShowLegend(2);
|
||||
* $dolgraph->setShowPercent(1);
|
||||
* $dolgraph->SetType(array('pie'));
|
||||
* $dolgraph->setWidth('100%');
|
||||
* $dolgraph->setHeight('200');
|
||||
* $dolgraph->draw('idofgraph');
|
||||
* print $dolgraph->show($total?0:1);
|
||||
*/
|
||||
@ -260,7 +260,8 @@ class DolGraph
|
||||
/**
|
||||
* Set type
|
||||
*
|
||||
* @param array $type Array with type for each serie. Example: array('pie', ...), array('lines', 'linesnopoint', 'bars', 'pie')
|
||||
* @param array $type Array with type for each serie. Example: array('type1', 'type2', ...) where type can be:
|
||||
* 'pie', 'piesemicircle', 'polar', 'lines', 'linesnopoint', 'bars', ...
|
||||
* @return void
|
||||
*/
|
||||
public function SetType($type)
|
||||
@ -421,7 +422,7 @@ class DolGraph
|
||||
/**
|
||||
* Show legend or not
|
||||
*
|
||||
* @param int $showlegend 1=Show legend (default), 0=Hide legend
|
||||
* @param int $showlegend 1=Show legend (default), 0=Hide legend, 2=Show legend on right
|
||||
* @return void
|
||||
*/
|
||||
public function setShowLegend($showlegend)
|
||||
@ -534,6 +535,8 @@ class DolGraph
|
||||
public function GetMaxValueInData()
|
||||
{
|
||||
// phpcs:enable
|
||||
if (! is_array($this->data)) return 0;
|
||||
|
||||
$k = 0;
|
||||
$vals = array();
|
||||
|
||||
@ -561,6 +564,8 @@ class DolGraph
|
||||
public function GetMinValueInData()
|
||||
{
|
||||
// phpcs:enable
|
||||
if (! is_array($this->data)) return 0;
|
||||
|
||||
$k = 0;
|
||||
$vals = array();
|
||||
|
||||
@ -715,7 +720,7 @@ class DolGraph
|
||||
$x++;
|
||||
}
|
||||
|
||||
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie')
|
||||
if (isset($this->type[$firstlot]) && in_array($this->type[$firstlot], array('pie', 'piesemicircle', 'polar')))
|
||||
{
|
||||
foreach ($values as $x => $y) {
|
||||
if (isset($y)) $serie[$i] .= 'd'.$i.'.push({"label":"'.dol_escape_js($legends[$x]).'", "data":'.$y.'});'."\n";
|
||||
@ -766,7 +771,7 @@ class DolGraph
|
||||
$this->stringtoshow .= "\n";
|
||||
|
||||
// Special case for Graph of type 'pie'
|
||||
if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'pie' || $this->type[$firstlot] == 'polar'))
|
||||
if (isset($this->type[$firstlot]) && in_array($this->type[$firstlot], array('pie', 'piesemicircle', 'polar')))
|
||||
{
|
||||
$datacolor = array();
|
||||
foreach ($this->datacolor as $val) {
|
||||
@ -933,7 +938,7 @@ class DolGraph
|
||||
* $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // or when there is n series to show for each x
|
||||
* $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // Syntax deprecated
|
||||
* $this->legend= array("Val1",...,"Valn"); // list of n series name
|
||||
* $this->type = array('bars',...'lines', 'linesnopoint'); or array('pie') or array('polar');
|
||||
* $this->type = array('bars',...'lines', 'linesnopoint'); or array('pie') or array('polar') or array('piesemicircle');
|
||||
* $this->mode = 'depth' ???
|
||||
* $this->bgcolorgrid
|
||||
* $this->datacolor
|
||||
@ -956,6 +961,8 @@ class DolGraph
|
||||
return;
|
||||
}
|
||||
|
||||
$showlegend = $this->showlegend;
|
||||
|
||||
$legends = array();
|
||||
$nblot = 0;
|
||||
if (is_array($this->data) && is_array($this->data[0])) {
|
||||
@ -966,48 +973,52 @@ class DolGraph
|
||||
// Works with line but not with bars
|
||||
//if ($nblot > 2) $firstlot = ($nblot - 2); // We limit nblot to 2 because jflot can't manage more than 2 bars on same x
|
||||
|
||||
$serie = array(); $arrayofgroupslegend = array();
|
||||
//var_dump($this->data);
|
||||
|
||||
$i = $firstlot;
|
||||
$serie = array();
|
||||
while ($i < $nblot) // Loop on each serie
|
||||
{
|
||||
$values = array(); // Array with horizontal y values (specific values of a serie) for each abscisse x
|
||||
$values = array(); // Array with horizontal y values (specific values of a serie) for each abscisse x (with x=0,1,2,...)
|
||||
$serie[$i] = "";
|
||||
|
||||
// Fill array $values
|
||||
$x = 0;
|
||||
foreach ($this->data as $valarray) // Loop on each x
|
||||
{
|
||||
$legends[$x] = $valarray[0];
|
||||
$values[$x] = (is_numeric($valarray[$i + 1]) ? $valarray[$i + 1] : null);
|
||||
$legends[$x] = (array_key_exists('label', $valarray) ? $valarray['label'] : $valarray[0]);
|
||||
$array_of_ykeys = array_keys($valarray);
|
||||
$alabelexists = 1;
|
||||
$tmpykey = explode('_', ($array_of_ykeys[$i+($alabelexists ? 1 : 0)]), 3);
|
||||
if (! empty($tmpykey[2]) || $tmpykey[2] == '0') { // This is a 'Group by' array
|
||||
$tmpvalue = (array_key_exists('y_'.$tmpykey[1].'_'.$tmpykey[2], $valarray) ? $valarray['y_'.$tmpykey[1].'_'.$tmpykey[2]] : $valarray[$i + 1]);
|
||||
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
|
||||
$arrayofgroupslegend[$i] = array(
|
||||
'stacknum'=> $tmpykey[1],
|
||||
'legend' => $this->Legend[$tmpykey[1]],
|
||||
'legendwithgroup' => $this->Legend[$tmpykey[1]].' - '.$tmpykey[2]
|
||||
);
|
||||
} else {
|
||||
$tmpvalue = (array_key_exists('y_'.$i, $valarray) ? $valarray['y_'.$i] : $valarray[$i + 1]);
|
||||
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
|
||||
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie')
|
||||
{
|
||||
$j = 0;
|
||||
foreach ($values as $x => $y) {
|
||||
//if (isset($y)) $serie[$i] .= 'd'.$i.'.push({"label":"'.dol_escape_js($legends[$x]).'", "data":'.$y.'});'."\n";
|
||||
if (isset($y)) {
|
||||
//$serie[$i][] = $y;
|
||||
$serie[$i] .= ($j > 0 ? ", " : "").$y;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$j = 0;
|
||||
foreach ($values as $x => $y) {
|
||||
if (isset($y)) {
|
||||
$serie[$i] .= ($j > 0 ? ", " : "").$y;
|
||||
$j++;
|
||||
}
|
||||
$j = 0;
|
||||
foreach ($values as $x => $y) {
|
||||
if (isset($y)) {
|
||||
$serie[$i] .= ($j > 0 ? ", " : "").$y;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
|
||||
unset($values);
|
||||
$values = null; // Free mem
|
||||
$i++;
|
||||
}
|
||||
//var_dump($serie);
|
||||
//var_dump($arrayofgroupslegend);
|
||||
|
||||
$tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
|
||||
|
||||
$this->stringtoshow = '<!-- Build using chart -->'."\n";
|
||||
@ -1024,7 +1035,7 @@ class DolGraph
|
||||
if (count($this->data) > 20) $dolxaxisvertical='dol-xaxis-vertical';
|
||||
// No height for the pie grah
|
||||
$cssfordiv = 'dolgraphchart';
|
||||
if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'pie' || $this->type[$firstlot] == 'polar')) $cssfordiv .= ' dolgraphcharpie';
|
||||
if (isset($this->type[$firstlot])) $cssfordiv .= ' dolgraphchar'.$this->type[$firstlot];
|
||||
$this->stringtoshow .= '<div id="placeholder_'.$tag.'" style="min-height: '.$this->height.(strpos($this->height, '%') > 0 ? '': 'px').'; width:'.$this->width.(strpos($this->width, '%') > 0 ? '': 'px').';" class="'.$cssfordiv.' dolgraph'.(empty($dolxaxisvertical)?'':' '.$dolxaxisvertical).(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"><canvas id="canvas_'.$tag.'"></canvas></div>'."\n";
|
||||
|
||||
$this->stringtoshow .= '<script id="'.$tag.'">'."\n";
|
||||
@ -1044,12 +1055,28 @@ class DolGraph
|
||||
}
|
||||
$this->stringtoshow .= "\n";
|
||||
|
||||
// Special case for Graph of type 'pie' or 'polar'
|
||||
if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'pie' || $this->type[$firstlot] == 'polar'))
|
||||
// Special case for Graph of type 'pie', 'piesemicircle', or 'polar'
|
||||
if (isset($this->type[$firstlot]) && (in_array($this->type[$firstlot], array('pie', 'polar', 'piesemicircle'))))
|
||||
{
|
||||
$type = $this->type[$firstlot]; // pie or polar
|
||||
$this->stringtoshow .= 'var options = {'."\n";
|
||||
$legendMaxLines= 0; // Does not work
|
||||
if (empty($showlegend)) {
|
||||
$this->stringtoshow .= 'legend: { display: false }, ';
|
||||
} else {
|
||||
$this->stringtoshow .= 'legend: { position: \''.($showlegend == 2 ? 'right' : 'top').'\'';
|
||||
if (! empty($legendMaxLines)) {
|
||||
$this->stringtoshow .= ', maxLines: '.$legendMaxLines.'';
|
||||
}
|
||||
$this->stringtoshow .= ' }, '."\n";
|
||||
}
|
||||
|
||||
$this->stringtoshow .= 'var options = { elements: { arc: {'."\n";
|
||||
if ($this->type[$firstlot] == 'piesemicircle') {
|
||||
$this->stringtoshow .= 'circumference: Math.PI,'."\n";
|
||||
$this->stringtoshow .= 'rotation: -Math.PI,'."\n";
|
||||
}
|
||||
$this->stringtoshow .= 'elements: { arc: {'."\n";
|
||||
// Color of earch arc
|
||||
$this->stringtoshow .= 'backgroundColor: [';
|
||||
$i = 0; $foundnegativecolor = 0;
|
||||
foreach($legends as $val) // Loop on each serie
|
||||
@ -1068,7 +1095,7 @@ class DolGraph
|
||||
$i++;
|
||||
}
|
||||
$this->stringtoshow .= '], '."\n";
|
||||
|
||||
// Border color
|
||||
if ($foundnegativecolor) {
|
||||
$this->stringtoshow .= 'borderColor: [';
|
||||
$i = 0;
|
||||
@ -1092,7 +1119,7 @@ class DolGraph
|
||||
var ctx = document.getElementById("canvas_'.$tag.'").getContext("2d");
|
||||
var chart = new Chart(ctx, {
|
||||
// The type of chart we want to create
|
||||
type: \''.($type == 'pie' ? 'doughnut' : 'polarArea').'\',
|
||||
type: \''.(in_array($type, array('pie', 'piesemicircle')) ? 'doughnut' : 'polarArea').'\',
|
||||
// Configuration options go here
|
||||
options: options,
|
||||
data: {
|
||||
@ -1134,9 +1161,24 @@ class DolGraph
|
||||
if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') $type = 'bar';
|
||||
if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) $type = 'line';
|
||||
|
||||
$this->stringtoshow .= '
|
||||
var options = { maintainAspectRatio: false, aspectRatio: 2.5 };
|
||||
$this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, ';
|
||||
if (empty($showlegend)) {
|
||||
$this->stringtoshow .= 'legend: { display: false }, ';
|
||||
}
|
||||
$this->stringtoshow .= 'scales: { xAxes: [{ ';
|
||||
//$this->stringtoshow .= 'type: \'time\', '; // Need Moment.js
|
||||
$this->stringtoshow .= 'distribution: \'linear\'';
|
||||
if ($type == 'bar' && count($arrayofgroupslegend) > 0) {
|
||||
$this->stringtoshow .= ', stacked: true';
|
||||
}
|
||||
$this->stringtoshow .= ' }]';
|
||||
if ($type == 'bar' && count($arrayofgroupslegend) > 0) {
|
||||
$this->stringtoshow .= ', yAxes: [{ stacked: true }]';
|
||||
}
|
||||
$this->stringtoshow .= ' }';
|
||||
$this->stringtoshow .= '};';
|
||||
|
||||
$this->stringtoshow .= '
|
||||
var ctx = document.getElementById("canvas_'.$tag.'").getContext("2d");
|
||||
var chart = new Chart(ctx, {
|
||||
// The type of chart we want to create
|
||||
@ -1154,24 +1196,78 @@ class DolGraph
|
||||
$i++;
|
||||
}
|
||||
|
||||
//var_dump($arrayofgroupslegend);
|
||||
|
||||
$this->stringtoshow .= '],
|
||||
datasets: [';
|
||||
$i = 0;
|
||||
|
||||
global $theme_datacolor;
|
||||
//var_dump($arrayofgroupslegend);
|
||||
$i = 0; $iinstack = 0;
|
||||
$oldstacknum = -1;
|
||||
while ($i < $nblot) // Loop on each serie
|
||||
{
|
||||
$color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].')';
|
||||
//$color = (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor));
|
||||
// We used a 'group by' and we have too many colors so we generated color variants per
|
||||
if (is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by.
|
||||
$nbofcolorneeds = count($arrayofgroupslegend);
|
||||
$nbofcolorsavailable = count($theme_datacolor);
|
||||
if ($nbofcolorneeds > $nbofcolorsavailable) {
|
||||
$usecolorvariantforgroypby = 1;
|
||||
}
|
||||
|
||||
if ($i > 0) $this->stringtoshow .= ', '."\n";
|
||||
$this->stringtoshow .= '{'."\n";
|
||||
$this->stringtoshow .= 'label: "'.$this->Legend[$i].'",';
|
||||
$textoflegend = $arrayofgroupslegend[$i]['legendwithgroup'];
|
||||
} else {
|
||||
$textoflegend = $this->Legend[$i];
|
||||
}
|
||||
if ($usecolorvariantforgroypby) {
|
||||
$newcolor = $this->datacolor[$arrayofgroupslegend[$i]['stacknum']];
|
||||
// If we change the stack
|
||||
if ($oldstacknum == -1 || $arrayofgroupslegend[$i]['stacknum'] != $oldstacknum) {
|
||||
$iinstack = 0;
|
||||
}
|
||||
|
||||
//var_dump($iinstack);
|
||||
if ($iinstack) {
|
||||
// Change color with offset of $$iinstack
|
||||
//var_dump($newcolor);
|
||||
if ($iinstack % 2) { // We increase agressiveness of reference color for color 2, 4, 6, ...
|
||||
$ratio = min(95, 10 + 10 * $iinstack); // step of 20
|
||||
$brightnessratio = min(90, 5 + 5 * $iinstack); // step of 10
|
||||
} else { // We decrease agressiveness of reference color for color 3, 5, 7, ..
|
||||
$ratio = max(-100, - 15 * $iinstack + 10); // step of -20
|
||||
$brightnessratio = min(90, 10 * $iinstack); // step of 20
|
||||
}
|
||||
//var_dump('Color '.($iinstack+1).' : '.$ratio.' '.$brightnessratio);
|
||||
|
||||
$newcolor = array_values(colorHexToRgb(colorAgressiveness(colorArrayToHex($newcolor), $ratio, $brightnessratio), false, true));
|
||||
}
|
||||
$oldstacknum = $arrayofgroupslegend[$i]['stacknum'];
|
||||
|
||||
$color = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].', 0.9)';
|
||||
$bordercolor = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].')';
|
||||
|
||||
} else { // We do not use a 'group by'
|
||||
$color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].', 0.9)';
|
||||
$bordercolor = $color;
|
||||
//$color = (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor));
|
||||
}
|
||||
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "\n";
|
||||
$this->stringtoshow .= '{';
|
||||
$this->stringtoshow .= 'dolibarrinfo: \'y_'.$i.'\', ';
|
||||
$this->stringtoshow .= 'label: \''.dol_escape_js(dol_string_nohtmltag($textoflegend)).'\', ';
|
||||
$this->stringtoshow .= 'pointStyle: \''.($this->type[$i] == 'linesnopoint' ? 'line' : 'circle').'\', ';
|
||||
$this->stringtoshow .= 'fill: '.($type == 'bar' ? 'true' : 'false').', ';
|
||||
$this->stringtoshow .= 'borderColor: \''.$color.'\', ';
|
||||
if ($type == 'bar') { $this->stringtoshow .= 'borderWidth: \'1\', '; }
|
||||
$this->stringtoshow .= 'borderColor: \''.$bordercolor.'\', ';
|
||||
$this->stringtoshow .= 'backgroundColor: \''.$color.'\', ';
|
||||
$this->stringtoshow .= ' data: ['.$serie[$i].']';
|
||||
if ($arrayofgroupslegend[$i]) $this->stringtoshow .= 'stack: \''.$arrayofgroupslegend[$i]['stacknum'].'\', ';
|
||||
$this->stringtoshow .= 'data: ['.$serie[$i].']';
|
||||
$this->stringtoshow .= '}'."\n";
|
||||
|
||||
$i++;
|
||||
$iinstack++;
|
||||
}
|
||||
$this->stringtoshow .= ']'."\n";
|
||||
$this->stringtoshow .= '}'."\n";
|
||||
|
||||
@ -3507,7 +3507,7 @@ class Form
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return list of payment methods
|
||||
* Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.
|
||||
* Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.
|
||||
*
|
||||
* @param string $selected Id du mode de paiement pre-selectionne
|
||||
* @param string $htmlname Nom de la zone select
|
||||
@ -5268,8 +5268,9 @@ class Form
|
||||
$disabled = false; $title = '';
|
||||
if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0")
|
||||
{
|
||||
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses
|
||||
if (empty($conf->global->OVERRIDE_VAT_FOR_EXPENSE_REPORT))
|
||||
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
|
||||
// of using supplier invoices (this is a very bad idea !)
|
||||
if (empty($conf->global->EXPENSEREPORT_OVERRIDE_VAT))
|
||||
{
|
||||
$title = ' title="'.$langs->trans('VATIsNotUsed').'"';
|
||||
$disabled = true;
|
||||
|
||||
@ -959,7 +959,7 @@ class FormCompany extends Form
|
||||
$out .= '<option value="2,3"'.($selected == '2,3' ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
|
||||
}
|
||||
$out .= '<option value="4"'.($selected == '4' ? ' selected' : '').'>'.$langs->trans('Supplier').'</option>';
|
||||
$out .= '<option value="0"'.($selected == '0' ? ' selected' : '').'>'.$langs->trans('Others').'</option>';
|
||||
$out .= '<option value="0"'.($selected == '0' ? ' selected' : '').'>'.$langs->trans('Other').'</option>';
|
||||
} elseif ($typeinput == 'admin') {
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
|
||||
$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
|
||||
|
||||
@ -1027,6 +1027,7 @@ class FormMail extends Form
|
||||
$out .= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is called at every key pressed ! */
|
||||
var code = e.keyCode || e.which;
|
||||
if (code == 13) {
|
||||
console.log("Enter was intercepted and blocked");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1338,4 +1338,120 @@ class FormOther
|
||||
$resultautomanual .= '</select>'."\n";
|
||||
return $resultautomanual;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return HTML select list to select a group by field
|
||||
*
|
||||
* @param mixed $object Object analyzed
|
||||
* @param array $search_groupby Array of preselected fields
|
||||
* @param array $arrayofgroupby Array of groupby to fill
|
||||
* @return string HTML string component
|
||||
*/
|
||||
public function selectGroupByField($object, $search_groupby, &$arrayofgroupby) {
|
||||
global $langs, $extrafields, $form;
|
||||
|
||||
$YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM=substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD=substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH=substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI=substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS=substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
if (in_array($key, array(
|
||||
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
|
||||
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
|
||||
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) continue;
|
||||
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) continue;
|
||||
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) continue;
|
||||
if (preg_match('/^pass/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$arrayofgroupby['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position'].'-y');
|
||||
$arrayofgroupby['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position'].'-m');
|
||||
$arrayofgroupby['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position'].'-d');
|
||||
} else {
|
||||
$arrayofgroupby['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add extrafields to Group by
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') continue;
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) continue;
|
||||
$arrayofgroupby['te.'.$key] = array('label' => $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1);
|
||||
$arrayofgroupbylabel = array();
|
||||
foreach ($arrayofgroupby as $key => $val) {
|
||||
$arrayofgroupbylabel[$key] = $val['label'];
|
||||
}
|
||||
$result = $form->selectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, 1, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML select list to select a group by field
|
||||
*
|
||||
* @param mixed $object Object analyzed
|
||||
* @param array $search_xaxis Array of preselected fields
|
||||
* @param array $arrayofxaxis Array of groupby to fill
|
||||
* @return string HTML string component
|
||||
*/
|
||||
public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis) {
|
||||
global $langs, $extrafields, $form;
|
||||
|
||||
$YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM=substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD=substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH=substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI=substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS=substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
|
||||
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
if (in_array($key, array(
|
||||
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
|
||||
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
|
||||
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) continue;
|
||||
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) continue;
|
||||
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) continue;
|
||||
if (preg_match('/^pass/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position'].'-y');
|
||||
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position'].'-m');
|
||||
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position'].'-d');
|
||||
} else {
|
||||
$arrayofxaxis['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add extrafields to X-Axis
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') continue;
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) continue;
|
||||
$arrayofxaxis['te.'.$key] = array('label' => $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 0, 0, 1);
|
||||
|
||||
$arrayofxaxislabel = array();
|
||||
foreach ($arrayofxaxis as $key => $val) {
|
||||
$arrayofxaxislabel[$key] = $val['label'];
|
||||
}
|
||||
$result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, 1, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,13 +269,14 @@ abstract class Stats
|
||||
*
|
||||
* @param int $year Year
|
||||
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
|
||||
* @param int $limit Limit
|
||||
* @return array Array of values
|
||||
*/
|
||||
public function getAllByProductEntry($year, $cachedelay = 0)
|
||||
public function getAllByProductEntry($year, $cachedelay = 0, $limit = 10)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$datay=array();
|
||||
$data=array();
|
||||
|
||||
// Search into cache
|
||||
if (! empty($cachedelay))
|
||||
@ -313,7 +314,7 @@ abstract class Stats
|
||||
}
|
||||
else
|
||||
{
|
||||
$data=$this->getAllByProduct($year);
|
||||
$data = $this->getAllByProduct($year, $limit);
|
||||
// $data[$i][]=$datay[$year][$i][1]; // set yval for x=i
|
||||
}
|
||||
|
||||
@ -604,7 +605,6 @@ abstract class Stats
|
||||
global $langs;
|
||||
|
||||
$result=array();
|
||||
$res=array();
|
||||
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -28,10 +28,6 @@
|
||||
if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
|
||||
{
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php";
|
||||
|
||||
// Get parameters
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
@ -45,8 +41,14 @@ if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
|
||||
|
||||
$search_filters = GETPOST('search_filters', 'array');
|
||||
$search_measures = GETPOST('search_measures', 'array');
|
||||
$search_xaxis = GETPOST('search_xaxis', 'array');
|
||||
$search_groupby = GETPOST('search_groupby', 'array');
|
||||
|
||||
//$search_xaxis = GETPOST('search_xaxis', 'array');
|
||||
if (GETPOST('search_xaxis', 'alpha') && GETPOST('search_xaxis', 'alpha') != '-1') $search_xaxis = array(GETPOST('search_xaxis', 'alpha'));
|
||||
else $search_xaxis = array();
|
||||
//$search_groupby = GETPOST('search_groupby', 'array');
|
||||
if (GETPOST('search_groupby', 'alpha') && GETPOST('search_groupby', 'alpha') != '-1') $search_groupby = array(GETPOST('search_groupby', 'alpha'));
|
||||
else $search_groupby = array();
|
||||
|
||||
$search_yaxis = GETPOST('search_yaxis', 'array');
|
||||
$search_graph = GETPOST('search_graph', 'none');
|
||||
|
||||
@ -63,8 +65,14 @@ if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
|
||||
$diroutputmassaction = $conf->user->dir_temp.'/'.$user->id.'/customreport';
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php";
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("companies", "other", "exports"));
|
||||
$langs->loadLangs(array("companies", "other", "exports", "sendings"));
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
@ -77,16 +85,18 @@ $object = null;
|
||||
$ObjectClassName = '';
|
||||
// Objects available by default
|
||||
$arrayoftype = array(
|
||||
'thirdparty' => array('label' => 'ThirdParties', 'ObjectClassName' => 'Societe', 'enabled' => $conf->societe->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"),
|
||||
'contact' => array('label' => 'Contacts', 'ObjectClassName' => 'Contact', 'enabled' => $conf->societe->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"),
|
||||
'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", 'langs'=>'contract'),
|
||||
'invoice' => array('label' => 'Invoices', 'ObjectClassName' => 'Facture', 'enabled' => $conf->facture->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"),
|
||||
'invoice_template'=>array('label' => 'PredefinedInvoices', 'ObjectClassName' => 'FactureRec', 'enabled' => $conf->facture->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/compta/class/facturerec.class.php", 'langs'=>'bills'),
|
||||
'thirdparty' => array('label' => 'ThirdParties', 'ObjectClassName' => 'Societe', 'enabled' => $conf->societe->enabled, 'ClassPath' => "/societe/class/societe.class.php"),
|
||||
'contact' => array('label' => 'Contacts', 'ObjectClassName' => 'Contact', 'enabled' => $conf->societe->enabled, 'ClassPath' => "/contact/class/contact.class.php"),
|
||||
'proposal' => array('label' => 'Proposals', 'ObjectClassName' => 'Propal', 'enabled' => $conf->propal->enabled, 'ClassPath' => "/comm/propal/class/propal.class.php"),
|
||||
'order' => array('label' => 'Orders', 'ObjectClassName' => 'Commande', 'enabled' => $conf->commande->enabled, 'ClassPath' => "/commande/class/commande.class.php"),
|
||||
'invoice' => array('label' => 'Invoices', 'ObjectClassName' => 'Facture', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/facture/class/facture.class.php"),
|
||||
'invoice_template'=>array('label' => 'PredefinedInvoices', 'ObjectClassName' => 'FactureRec', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/class/facturerec.class.php", 'langs'=>'bills'),
|
||||
'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contract'),
|
||||
'bom' => array('label' => 'BOM', 'ObjectClassName' => 'Bom', 'enabled' => $conf->bom->enabled),
|
||||
'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mrp->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/mrp/class/mo.class.php"),
|
||||
'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mrp->enabled, 'ClassPath' => "/mrp/class/mo.class.php"),
|
||||
'ticket' => array('label' => 'Ticket', 'ObjectClassName' => 'Ticket', 'enabled' => $conf->ticket->enabled),
|
||||
'member' => array('label' => 'Adherent', 'ObjectClassName' => 'Adherent', 'enabled' => $conf->adherent->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", 'langs'=>'members'),
|
||||
'cotisation' => array('label' => 'Subscriptions', 'ObjectClassName' => 'Subscription', 'enabled' => $conf->adherent->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/adherents/class/subscription.class.php", 'langs'=>'members'),
|
||||
'member' => array('label' => 'Adherent', 'ObjectClassName' => 'Adherent', 'enabled' => $conf->adherent->enabled, 'ClassPath' => "/adherents/class/adherent.class.php", 'langs'=>'members'),
|
||||
'cotisation' => array('label' => 'Subscriptions', 'ObjectClassName' => 'Subscription', 'enabled' => $conf->adherent->enabled, 'ClassPath' => "/adherents/class/subscription.class.php", 'langs'=>'members'),
|
||||
);
|
||||
|
||||
// Complete $arrayoftype by external modules
|
||||
@ -108,17 +118,14 @@ elseif (is_array($hookmanager->resArray)) {
|
||||
$arrayoftype[$key] = $val;
|
||||
}
|
||||
}
|
||||
if (!empty($hookmanager->resArray['modenotusedforlist'])) { // Show objecttype selection even if objecttype is set
|
||||
$modenotusedforlist = $hookmanager->resArray['modenotusedforlist'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($objecttype) {
|
||||
try {
|
||||
if ($arrayoftype[$objecttype]['ClassPath']) {
|
||||
include_once $arrayoftype[$objecttype]['ClassPath'];
|
||||
if (! empty($arrayoftype[$objecttype]['ClassPath'])) {
|
||||
dol_include_once($arrayoftype[$objecttype]['ClassPath']);
|
||||
} else {
|
||||
include_once DOL_DOCUMENT_ROOT."/".$objecttype."/class/".$objecttype.".class.php";
|
||||
dol_include_once("/".$objecttype."/class/".$objecttype.".class.php");
|
||||
}
|
||||
$ObjectClassName = $arrayoftype[$objecttype]['ObjectClassName'];
|
||||
$object = new $ObjectClassName($db);
|
||||
@ -135,6 +142,7 @@ if ($user->socid > 0) // Protection if external user
|
||||
//$socid = $user->socid;
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, $object->element, 0, '');
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
@ -145,6 +153,23 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
|
||||
$search_component_params = array('');
|
||||
|
||||
$MAXUNIQUEVALFORGROUP = 20;
|
||||
$MAXMEASURESINBARGRAPH = 20;
|
||||
|
||||
$YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM=substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD=substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH=substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI=substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS=substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
|
||||
$arrayofmesures = array('t.count'=>'Count');
|
||||
$arrayofxaxis = array();
|
||||
$arrayofgroupby = array();
|
||||
$arrayofyaxis = array();
|
||||
$arrayofvaluesforgroupby = array();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -159,6 +184,7 @@ $search_component_params = array('');
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE')) {
|
||||
llxHeader('', $langs->transnoentitiesnoconv('CustomReports'), '');
|
||||
@ -175,17 +201,88 @@ if ($action == 'viewgraph') {
|
||||
$search_xaxis = array(0 => $search_xaxis[0]);
|
||||
}
|
||||
if (count($search_groupby) >= 2) {
|
||||
setEventMessages($langs->trans("OnlyOneFieldForGroupByIsPossible"), null, 'warnings');
|
||||
$search_groupby = array(0 => $search_groupb[0]);
|
||||
setEventMessages($langs->trans("ErrorOnlyOneFieldForGroupByIsPossible"), null, 'warnings');
|
||||
$search_groupby = array(0 => $search_groupby[0]);
|
||||
}
|
||||
if (!count($search_xaxis)) {
|
||||
setEventMessages($langs->trans("AtLeastOneXAxisIsRequired"), null, 'warnings');
|
||||
} elseif ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > 3) {
|
||||
setEventMessages($langs->trans("GraphInBarsAreLimitedTo3Measures"), null, 'warnings');
|
||||
} elseif ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > $MAXMEASURESINBARGRAPH) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("GraphInBarsAreLimitedToNMeasures", $MAXMEASURESINBARGRAPH), null, 'warnings');
|
||||
$search_graph = 'lines';
|
||||
}
|
||||
}
|
||||
|
||||
// Get all possible values of fields when a 'group by' is set and save this into $arrayofvaluesforgroupby
|
||||
if (is_array($search_groupby) && count($search_groupby)) {
|
||||
foreach($search_groupby as $gkey => $gval) {
|
||||
$gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval);
|
||||
|
||||
if (preg_match('/\-year$/', $search_groupby[$gkey])) {
|
||||
$tmpval = preg_replace('/\-year$/', '', $search_groupby[$gkey]);
|
||||
$fieldtocount .= 'DATE_FORMAT('.$tmpval.", '%Y')";
|
||||
} elseif (preg_match('/\-month$/', $search_groupby[$gkey])) {
|
||||
$tmpval = preg_replace('/\-month$/', '', $search_groupby[$gkey]);
|
||||
$fieldtocount .= 'DATE_FORMAT('.$tmpval.", '%Y-%m')";
|
||||
} elseif (preg_match('/\-day$/', $search_groupby[$gkey])) {
|
||||
$tmpval = preg_replace('/\-day$/', '', $search_groupby[$gkey]);
|
||||
$fieldtocount .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d')";
|
||||
} else {
|
||||
$fieldtocount = $search_groupby[$gkey];
|
||||
}
|
||||
|
||||
$sql = 'SELECT DISTINCT '.$fieldtocount.' as val';
|
||||
if (strpos($fieldtocount, 'te.') === 0) {
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te';
|
||||
} else {
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
|
||||
}
|
||||
// TODO Add the where here
|
||||
|
||||
$sql.= ' LIMIT '.($MAXUNIQUEVALFORGROUP + 1);
|
||||
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
if (is_null($obj->val)) {
|
||||
$keytouse = '__NULL__';
|
||||
$valuetranslated = $langs->transnoentitiesnoconv("NotDefined");
|
||||
}
|
||||
elseif ($obj->val === '') {
|
||||
$keytouse = '';
|
||||
$valuetranslated = $langs->transnoentitiesnoconv("Empty");
|
||||
}
|
||||
else {
|
||||
$keytouse = (string) $obj->val;
|
||||
$valuetranslated = $obj->val;
|
||||
}
|
||||
if (!empty($object->fields[$gvalwithoutprefix]['arrayofkeyval'])) {
|
||||
$valuetranslated = $object->fields[$gvalwithoutprefix]['arrayofkeyval'][$obj->val];
|
||||
}
|
||||
|
||||
$arrayofvaluesforgroupby['g_'.$gkey][$keytouse] = $valuetranslated;
|
||||
}
|
||||
asort($arrayofvaluesforgroupby['g_'.$gkey]);
|
||||
|
||||
if (count($arrayofvaluesforgroupby['g_'.$gkey]) > $MAXUNIQUEVALFORGROUP) {
|
||||
$langs->load("errors");
|
||||
//var_dump($gkey.' '.$gval.' '.$gvalwithoutprefix);
|
||||
$gvalwithoutprefix = preg_replace('/\-(year|month|day)/', '', $gvalwithoutprefix);
|
||||
$labeloffield = $langs->transnoentitiesnoconv($object->fields[$gvalwithoutprefix]['label']);
|
||||
setEventMessages($langs->trans("ErrorTooManyDifferentValueForSelectedGroupBy", $MAXUNIQUEVALFORGROUP, $labeloffield), null, 'warnings');
|
||||
$search_groupby = array();
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
}
|
||||
//var_dump($arrayofvaluesforgroupby);exit;
|
||||
|
||||
|
||||
$tmparray = dol_getdate(dol_now());
|
||||
$endyear = $tmparray['year'];
|
||||
$endmonth = $tmparray['mon'];
|
||||
@ -194,12 +291,6 @@ $startyear = $endyear - 2;
|
||||
|
||||
$param = '';
|
||||
|
||||
$arrayofmesures = array('t.count'=>'Count');
|
||||
$arrayofxaxis = array();
|
||||
$arrayofgroupby = array();
|
||||
$arrayofyaxis = array();
|
||||
$arrayofvaluesforgroupby = array();
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="viewgraph">';
|
||||
@ -219,7 +310,7 @@ foreach ($arrayoftype as $key => $val) {
|
||||
$langs->load($val['langs']);
|
||||
}
|
||||
}
|
||||
print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', '', 1);
|
||||
print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', 'minwidth200', 1);
|
||||
if (empty($conf->use_javascript_ajax)) print '<input type="submit" class="button" name="changeobjecttype" value="'.$langs->trans("Refresh").'">';
|
||||
else {
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
@ -238,20 +329,20 @@ print '<div class="divadvancedsearchfield quatrevingtpercent">';
|
||||
print $form->searchComponent(array($object->element => $object->fields), $search_component_params);
|
||||
print '</div>';
|
||||
|
||||
// Measures
|
||||
// Add measures into array
|
||||
print '<div class="divadvancedsearchfield clearboth">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if ($val['isameasure']) {
|
||||
if (!empty($val['isameasure']) && (! isset($val['enabled']) || dol_eval($val['enabled'], 1))) {
|
||||
$arrayofmesures['t.'.$key.'-sum'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
|
||||
$arrayofmesures['t.'.$key.'-average'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
|
||||
$arrayofmesures['t.'.$key.'-min'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
|
||||
$arrayofmesures['t.'.$key.'-max'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Maximum").')</span>';
|
||||
}
|
||||
}
|
||||
// Add measure from extrafields
|
||||
// Add extrafields to Measures
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (! isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1))) {
|
||||
$arrayofmesures['te.'.$key.'-sum'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
|
||||
$arrayofmesures['te.'.$key.'-average'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
|
||||
$arrayofmesures['te.'.$key.'-min'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
|
||||
@ -259,100 +350,37 @@ if ($object->isextrafieldmanaged) {
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-chart-line paddingright" title="'.$langs->trans("Measures").'"></span>'.$langs->trans("Measures").'</div> ';
|
||||
print '<div class="inline-block"><span class="fas fa-chart-line paddingright" title="'.$langs->trans("Measures").'"></span>'.$langs->trans("Measures").'</div> ';
|
||||
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth500', 1);
|
||||
print '</div>';
|
||||
|
||||
|
||||
// Group by
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
if (in_array($key, array(
|
||||
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
|
||||
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
|
||||
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) continue;
|
||||
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) continue;
|
||||
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) continue;
|
||||
if (preg_match('/^pass/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$arrayofgroupby['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Year").')', 'position' => $val['position'].'-y');
|
||||
$arrayofgroupby['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Month").')', 'position' => $val['position'].'-m');
|
||||
$arrayofgroupby['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Day").')', 'position' => $val['position'].'-d');
|
||||
} else {
|
||||
$arrayofgroupby['t.'.$key] = array('label' => $val['label'], 'position' => (int) $val['position']);
|
||||
}
|
||||
}
|
||||
// Add measure from extrafields
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') continue;
|
||||
$arrayofgroupby['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 1);
|
||||
$arrayofgroupbylabel = array();
|
||||
foreach ($arrayofgroupby as $key => $val) {
|
||||
$arrayofgroupbylabel[$key] = $val['label'];
|
||||
}
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("GroupBy").'"></span>'.$langs->trans("GroupBy").'</div> ';
|
||||
print $form->multiselectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, 0, 0, 'minwidth250', 1);
|
||||
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby);
|
||||
print '</div>';
|
||||
|
||||
|
||||
// XAxis
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
if (in_array($key, array(
|
||||
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
|
||||
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
|
||||
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) continue;
|
||||
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) continue;
|
||||
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) continue;
|
||||
if (preg_match('/^pass/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Year").')', 'position' => $val['position'].'-y');
|
||||
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Month").')', 'position' => $val['position'].'-m');
|
||||
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Day").')', 'position' => $val['position'].'-d');
|
||||
} else {
|
||||
$arrayofxaxis['t.'.$key] = array('label' => $val['label'], 'position' => (int) $val['position']);
|
||||
}
|
||||
}
|
||||
// Add measure from extrafields
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') continue;
|
||||
$arrayofxaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 1);
|
||||
$arrayofxaxislabel = array();
|
||||
foreach ($arrayofxaxis as $key => $val) {
|
||||
$arrayofxaxislabel[$key] = $val['label'];
|
||||
}
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("XAxis").'"></span>'.$langs->trans("XAxis").'</div> ';
|
||||
print $form->multiselectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, 0, 0, 'minwidth250', 1);
|
||||
print '<div class="inline-block"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("XAxis").'"></span>'.$langs->trans("XAxis").'</div> ';
|
||||
print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis);
|
||||
print '</div>';
|
||||
|
||||
// YAxis
|
||||
|
||||
if ($mode == 'grid') {
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
// YAxis
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
if (empty($val['measure']) && (! isset($val['enabled']) || dol_eval($val['enabled'], 1))) {
|
||||
if (in_array($key, array('id', 'rowid', 'entity', 'last_main_doc', 'extraparams'))) continue;
|
||||
if (preg_match('/^fk_/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$arrayofyaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Year").')', 'position' => $val['position']);
|
||||
$arrayofyaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Month").')', 'position' => $val['position']);
|
||||
$arrayofyaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Day").')', 'position' => $val['position']);
|
||||
$arrayofyaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position']);
|
||||
$arrayofyaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position']);
|
||||
$arrayofyaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position']);
|
||||
} else {
|
||||
$arrayofyaxis['t.'.$key] = array('label' => $val['label'], 'position' => (int) $val['position']);
|
||||
}
|
||||
@ -360,8 +388,8 @@ if ($mode == 'grid') {
|
||||
// Add measure from extrafields
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||
$arrayofyaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (! isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1))) {
|
||||
$arrayofyaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -389,20 +417,6 @@ print '</div>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
// Get all possible values of fields when a group by is set
|
||||
if (is_array($search_groupby) && count($search_groupby)) {
|
||||
$sql = 'SELECT DISTINCT '.$search_groupby[0].' as val FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$arrayofvaluesforgroupby[$obj->val] = $obj->val;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the SQL request
|
||||
$sql = '';
|
||||
if (!empty($search_measures) && !empty($search_xaxis))
|
||||
@ -426,15 +440,15 @@ if (!empty($search_measures) && !empty($search_xaxis))
|
||||
foreach ($search_groupby as $key => $val) {
|
||||
if (preg_match('/\-year$/', $val)) {
|
||||
$tmpval = preg_replace('/\-year$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y'), ";
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y') as g_".$key.', ';
|
||||
} elseif (preg_match('/\-month$/', $val)) {
|
||||
$tmpval = preg_replace('/\-month$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m'), ";
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m') as g_".$key.', ';
|
||||
} elseif (preg_match('/\-day$/', $val)) {
|
||||
$tmpval = preg_replace('/\-day$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d'), ";
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d') as g_".$key.', ';
|
||||
}
|
||||
else $sql .= $val.', ';
|
||||
else $sql .= $val.' as g_'.$key.', ';
|
||||
}
|
||||
foreach ($search_measures as $key => $val) {
|
||||
if ($val == 't.count') $sql .= 'COUNT(t.'.$fieldid.') as y_'.$key.', ';
|
||||
@ -475,7 +489,7 @@ if (!empty($search_measures) && !empty($search_xaxis))
|
||||
$sql .= ' AND entity IN ('.getEntity($object->element).')';
|
||||
}
|
||||
foreach ($search_filters as $key => $val) {
|
||||
// TODO
|
||||
// TODO Add the where here
|
||||
}
|
||||
$sql .= ' GROUP BY ';
|
||||
foreach ($search_xaxis as $key => $val) {
|
||||
@ -519,15 +533,32 @@ if (!empty($search_measures) && !empty($search_xaxis))
|
||||
}
|
||||
else $sql .= $val.', ';
|
||||
}
|
||||
foreach ($search_groupby as $key => $val) {
|
||||
if (preg_match('/\-year$/', $val)) {
|
||||
$tmpval = preg_replace('/\-year$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y'), ";
|
||||
} elseif (preg_match('/\-month$/', $val)) {
|
||||
$tmpval = preg_replace('/\-month$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m'), ";
|
||||
} elseif (preg_match('/\-day$/', $val)) {
|
||||
$tmpval = preg_replace('/\-day$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d'), ";
|
||||
}
|
||||
else $sql .= $val.', ';
|
||||
}
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
}
|
||||
|
||||
//print $sql;
|
||||
|
||||
$legend = array();
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$legend[] = $langs->trans($arrayofmesures[$val]);
|
||||
}
|
||||
|
||||
$useagroupby = (is_array($search_groupby) && count($search_groupby));
|
||||
//var_dump($useagroupby);
|
||||
//var_dump($arrayofvaluesforgroupby);
|
||||
|
||||
// Execute the SQL request
|
||||
$totalnbofrecord = 0;
|
||||
$data = array();
|
||||
@ -537,26 +568,111 @@ if ($sql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$ifetch = 0; $xi = 0; $oldlabeltouse = '';
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
// $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // or when there is n series to show for each x
|
||||
foreach ($search_xaxis as $xkey => $xval) {
|
||||
$fieldforxkey = 'x_'.$xkey;
|
||||
$xlabel = $obj->$fieldforxkey;
|
||||
$xvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $xval);
|
||||
if (!empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) {
|
||||
$xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey];
|
||||
}
|
||||
$xarray = array(0 => (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : $langs->trans("NotDefined")));
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$fieldfory = 'y_'.$key;
|
||||
$xarray[] = $obj->$fieldfory;
|
||||
}
|
||||
$data[] = $xarray;
|
||||
}
|
||||
$ifetch++;
|
||||
if ($useagroupby) {
|
||||
$xval = $search_xaxis[0];
|
||||
$fieldforxkey = 'x_0';
|
||||
$xlabel = $obj->$fieldforxkey;
|
||||
$xvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $xval);
|
||||
if (!empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) {
|
||||
$xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey];
|
||||
}
|
||||
$labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->trans("Empty") : $langs->trans("NotDefined")));
|
||||
|
||||
if ($oldlabeltouse && ($labeltouse != $oldlabeltouse)) {
|
||||
$xi++; // Increase $xi
|
||||
}
|
||||
//var_dump($labeltouse.' '.$oldlabeltouse.' '.$xi);
|
||||
$oldlabeltouse = $labeltouse;
|
||||
|
||||
/* Example of value for $arrayofvaluesforgroupby
|
||||
* array (size=1)
|
||||
* 'g_0' =>
|
||||
* array (size=6)
|
||||
* 0 => string '0' (length=1)
|
||||
* '' => string 'Empty' (length=5)
|
||||
* '__NULL__' => string 'Not defined' (length=11)
|
||||
* 'done' => string 'done' (length=4)
|
||||
* 'processing' => string 'processing' (length=10)
|
||||
* 'undeployed' => string 'undeployed' (length=10)
|
||||
*/
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$gi = 0;
|
||||
foreach ($search_groupby as $gkey) {
|
||||
//var_dump('*** Fetch #'.$ifetch.' for labeltouse='.$labeltouse.' measure number '.$key.' and group g_'.$gi);
|
||||
//var_dump($arrayofvaluesforgroupby);
|
||||
foreach($arrayofvaluesforgroupby['g_'.$gi] as $gvaluepossiblekey => $gvaluepossiblelabel) {
|
||||
$ykeysuffix = $gvaluepossiblelabel;
|
||||
$gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval);
|
||||
|
||||
$fieldfory = 'y_'.$key;
|
||||
$fieldforg = 'g_'.$gi;
|
||||
$fieldforybis = 'y_'.$key.'_'.$ykeysuffix;
|
||||
//var_dump('gvaluepossiblekey='.$gvaluepossiblekey.' gvaluepossiblelabel='.$gvaluepossiblelabel.' ykeysuffix='.$ykeysuffix.' gval='.$gval.' gvalwithoutsuffix='.$gvalwithoutprefix);
|
||||
//var_dump('fieldforg='.$fieldforg.' obj->$fieldforg='.$obj->$fieldforg.' fieldfory='.$fieldfory.' obj->$fieldfory='.$obj->$fieldfory.' fieldforybis='.$fieldforybis);
|
||||
|
||||
if (! is_array($data[$xi])) $data[$xi] = array();
|
||||
|
||||
if (! array_key_exists('label', $data[$xi])) {
|
||||
$data[$xi] = array();
|
||||
$data[$xi]['label'] = $labeltouse;
|
||||
}
|
||||
|
||||
$objfieldforg = $obj->$fieldforg;
|
||||
if (is_null($objfieldforg)) $objfieldforg = '__NULL__';
|
||||
|
||||
if ($gvaluepossiblekey == '0') { // $gvaluepossiblekey can have type int or string. So we create a special if, used when value is '0'
|
||||
//var_dump($objfieldforg.' == \'0\' -> '.($objfieldforg == '0'));
|
||||
if ($objfieldforg == '0') {
|
||||
// The record we fetch is for this group
|
||||
$data[$xi][$fieldforybis] = $obj->$fieldfory;
|
||||
}
|
||||
// The record we fetch is not for this group
|
||||
elseif (! isset($data[$xi][$fieldforybis])) {
|
||||
$data[$xi][$fieldforybis] = '0';
|
||||
}
|
||||
} else {
|
||||
//var_dump((string) $objfieldforg.' === '.(string) $gvaluepossiblekey.' -> '.((string) $objfieldforg === (string) $gvaluepossiblekey));
|
||||
if ((string) $objfieldforg === (string) $gvaluepossiblekey) {
|
||||
// The record we fetch is for this group
|
||||
$data[$xi][$fieldforybis] = $obj->$fieldfory;
|
||||
}
|
||||
// The record we fetch is not for this group
|
||||
elseif (! isset($data[$xi][$fieldforybis])) {
|
||||
$data[$xi][$fieldforybis] = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($data[$xi]);
|
||||
$gi++;
|
||||
}
|
||||
}
|
||||
} else { // No group by
|
||||
$xval = $search_xaxis[0];
|
||||
$fieldforxkey = 'x_0';
|
||||
$xlabel = $obj->$fieldforxkey;
|
||||
$xvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $xval);
|
||||
|
||||
if (!empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) {
|
||||
$xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey];
|
||||
}
|
||||
|
||||
$labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->trans("Empty") : $langs->trans("NotDefined")));
|
||||
$xarrayforallseries = array('label' => $labeltouse);
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$fieldfory = 'y_'.$key;
|
||||
$xarrayforallseries[$fieldfory] = $obj->$fieldfory;
|
||||
}
|
||||
$data[$xi] = $xarrayforallseries;
|
||||
$xi++;
|
||||
}
|
||||
}
|
||||
|
||||
$totalnbofrecord = count($data);
|
||||
}
|
||||
//var_dump($data);
|
||||
|
||||
|
||||
print '<div class="customreportsoutput'.($totalnbofrecord ? '' : ' customreportsoutputnotdata').'">';
|
||||
@ -569,7 +685,7 @@ if ($mode == 'grid') {
|
||||
if ($mode == 'graph') {
|
||||
$WIDTH = '80%';
|
||||
$HEIGHT = 200;
|
||||
var_dump($data);
|
||||
|
||||
// Show graph
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
|
||||
@ -3110,7 +3110,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
||||
if (empty($srconly) && in_array($pictowithouttext, array(
|
||||
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
|
||||
'address', 'barcode', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
|
||||
'address', 'barcode', 'bank', 'bookmark', 'building', 'cash-register', 'check', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
|
||||
'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
|
||||
'object_bookmark', 'object_list', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
|
||||
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
|
||||
@ -3135,7 +3135,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
$arrayconvpictotofa = array(
|
||||
'address'=> 'address-book', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt',
|
||||
'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'generic'=>'folder-open',
|
||||
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'object_bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar',
|
||||
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'object_bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar',
|
||||
'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-branch',
|
||||
'object_list'=>'list-alt', 'object_calendar'=>'calendar-alt', 'object_calendarweek'=>'calendar-week', 'object_calendarmonth'=>'calendar-alt', 'object_calendarday'=>'calendar-day', 'object_calendarperuser'=>'table',
|
||||
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
|
||||
@ -3155,6 +3155,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
$morecss .= ($morecss ? ' ' : '').'font-status4';
|
||||
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
|
||||
}
|
||||
elseif ($pictowithouttext == 'check') {
|
||||
$morecss .= ($morecss ? ' ' : '').'font-status4';
|
||||
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
|
||||
}
|
||||
elseif ($pictowithouttext == 'off') {
|
||||
$fakey = 'fa-square';
|
||||
$fasize = '1.3em';
|
||||
@ -8614,6 +8618,160 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
|
||||
return $button;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with properties of an element.
|
||||
* Called by fetchObjectByElement.
|
||||
*
|
||||
* @param string $element_type Element type (Value of $object->element). Example: 'action', 'facture', 'project_task' or 'object@mymodule'...
|
||||
* @return array (module, classpath, element, subelement, classfile, classname)
|
||||
*/
|
||||
function getElementProperties($element_type)
|
||||
{
|
||||
$regs = array();
|
||||
|
||||
$classfile = $classname = $classpath = '';
|
||||
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$module = $element_type;
|
||||
$element = $element_type;
|
||||
$subelement = $element_type;
|
||||
|
||||
// If we ask an resource form external module (instead of default path)
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $element_type, $regs)) {
|
||||
$element = $subelement = $regs[1];
|
||||
$module = $regs[2];
|
||||
}
|
||||
|
||||
//print '<br>1. element : '.$element.' - module : '.$module .'<br>';
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i', $element, $regs)) {
|
||||
$module = $element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
// For compat
|
||||
if ($element_type == "action") {
|
||||
$classpath = 'comm/action/class';
|
||||
$subelement = 'Actioncomm';
|
||||
$module = 'agenda';
|
||||
}
|
||||
|
||||
// To work with non standard path
|
||||
if ($element_type == 'facture' || $element_type == 'invoice') {
|
||||
$classpath = 'compta/facture/class';
|
||||
$module = 'facture';
|
||||
$subelement = 'facture';
|
||||
}
|
||||
if ($element_type == 'commande' || $element_type == 'order') {
|
||||
$classpath = 'commande/class';
|
||||
$module = 'commande';
|
||||
$subelement = 'commande';
|
||||
}
|
||||
if ($element_type == 'propal') {
|
||||
$classpath = 'comm/propal/class';
|
||||
}
|
||||
if ($element_type == 'supplier_proposal') {
|
||||
$classpath = 'supplier_proposal/class';
|
||||
}
|
||||
if ($element_type == 'shipping') {
|
||||
$classpath = 'expedition/class';
|
||||
$subelement = 'expedition';
|
||||
$module = 'expedition_bon';
|
||||
}
|
||||
if ($element_type == 'delivery') {
|
||||
$classpath = 'livraison/class';
|
||||
$subelement = 'livraison';
|
||||
$module = 'livraison_bon';
|
||||
}
|
||||
if ($element_type == 'contract') {
|
||||
$classpath = 'contrat/class';
|
||||
$module = 'contrat';
|
||||
$subelement = 'contrat';
|
||||
}
|
||||
if ($element_type == 'member') {
|
||||
$classpath = 'adherents/class';
|
||||
$module = 'adherent';
|
||||
$subelement = 'adherent';
|
||||
}
|
||||
if ($element_type == 'cabinetmed_cons') {
|
||||
$classpath = 'cabinetmed/class';
|
||||
$module = 'cabinetmed';
|
||||
$subelement = 'cabinetmedcons';
|
||||
}
|
||||
if ($element_type == 'fichinter') {
|
||||
$classpath = 'fichinter/class';
|
||||
$module = 'ficheinter';
|
||||
$subelement = 'fichinter';
|
||||
}
|
||||
if ($element_type == 'dolresource' || $element_type == 'resource') {
|
||||
$classpath = 'resource/class';
|
||||
$module = 'resource';
|
||||
$subelement = 'dolresource';
|
||||
}
|
||||
if ($element_type == 'propaldet') {
|
||||
$classpath = 'comm/propal/class';
|
||||
$module = 'propal';
|
||||
$subelement = 'propaleligne';
|
||||
}
|
||||
if ($element_type == 'order_supplier') {
|
||||
$classpath = 'fourn/class';
|
||||
$module = 'fournisseur';
|
||||
$subelement = 'commandefournisseur';
|
||||
$classfile = 'fournisseur.commande';
|
||||
}
|
||||
if ($element_type == 'invoice_supplier') {
|
||||
$classpath = 'fourn/class';
|
||||
$module = 'fournisseur';
|
||||
$subelement = 'facturefournisseur';
|
||||
$classfile = 'fournisseur.facture';
|
||||
}
|
||||
if ($element_type == "service") {
|
||||
$classpath = 'product/class';
|
||||
$subelement = 'product';
|
||||
}
|
||||
|
||||
if (empty($classfile)) $classfile = strtolower($subelement);
|
||||
if (empty($classname)) $classname = ucfirst($subelement);
|
||||
if (empty($classpath)) $classpath = $module.'/class';
|
||||
|
||||
$element_properties = array(
|
||||
'module' => $module,
|
||||
'classpath' => $classpath,
|
||||
'element' => $element,
|
||||
'subelement' => $subelement,
|
||||
'classfile' => $classfile,
|
||||
'classname' => $classname
|
||||
);
|
||||
return $element_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch an object from its id and element_type
|
||||
* Inclusion of classes is automatic
|
||||
*
|
||||
* @param int $element_id Element id
|
||||
* @param string $element_type Element type
|
||||
* @param string $element_ref Element ref (Use this or element_id but not both)
|
||||
* @return int|object object || 0 || -1 if error
|
||||
*/
|
||||
function fetchObjectByElement($element_id, $element_type, $element_ref = '')
|
||||
{
|
||||
global $conf, $db;
|
||||
|
||||
$element_prop = getElementProperties($element_type);
|
||||
if (is_array($element_prop) && $conf->{$element_prop['module']}->enabled)
|
||||
{
|
||||
dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');
|
||||
|
||||
$objecttmp = new $element_prop['classname']($db);
|
||||
$ret = $objecttmp->fetch($element_id, $element_ref);
|
||||
if ($ret >= 0)
|
||||
{
|
||||
return $objecttmp;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if a file can contains executable content
|
||||
*
|
||||
|
||||
@ -2058,157 +2058,6 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with properties of an element
|
||||
*
|
||||
* @param string $element_type Element type: 'action', 'facture', 'project_task' or 'object@mymodule'...
|
||||
* @return array (module, classpath, element, subelement, classfile, classname)
|
||||
*/
|
||||
function getElementProperties($element_type)
|
||||
{
|
||||
$regs = array();
|
||||
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$module = $element_type;
|
||||
$element = $element_type;
|
||||
$subelement = $element_type;
|
||||
|
||||
// If we ask an resource form external module (instead of default path)
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $element_type, $regs)) {
|
||||
$element = $subelement = $regs[1];
|
||||
$module = $regs[2];
|
||||
}
|
||||
|
||||
//print '<br>1. element : '.$element.' - module : '.$module .'<br>';
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i', $element, $regs)) {
|
||||
$module = $element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
// For compat
|
||||
if ($element_type == "action") {
|
||||
$classpath = 'comm/action/class';
|
||||
$subelement = 'Actioncomm';
|
||||
$module = 'agenda';
|
||||
}
|
||||
|
||||
// To work with non standard path
|
||||
if ($element_type == 'facture' || $element_type == 'invoice') {
|
||||
$classpath = 'compta/facture/class';
|
||||
$module = 'facture';
|
||||
$subelement = 'facture';
|
||||
}
|
||||
if ($element_type == 'commande' || $element_type == 'order') {
|
||||
$classpath = 'commande/class';
|
||||
$module = 'commande';
|
||||
$subelement = 'commande';
|
||||
}
|
||||
if ($element_type == 'propal') {
|
||||
$classpath = 'comm/propal/class';
|
||||
}
|
||||
if ($element_type == 'supplier_proposal') {
|
||||
$classpath = 'supplier_proposal/class';
|
||||
}
|
||||
if ($element_type == 'shipping') {
|
||||
$classpath = 'expedition/class';
|
||||
$subelement = 'expedition';
|
||||
$module = 'expedition_bon';
|
||||
}
|
||||
if ($element_type == 'delivery') {
|
||||
$classpath = 'livraison/class';
|
||||
$subelement = 'livraison';
|
||||
$module = 'livraison_bon';
|
||||
}
|
||||
if ($element_type == 'contract') {
|
||||
$classpath = 'contrat/class';
|
||||
$module = 'contrat';
|
||||
$subelement = 'contrat';
|
||||
}
|
||||
if ($element_type == 'member') {
|
||||
$classpath = 'adherents/class';
|
||||
$module = 'adherent';
|
||||
$subelement = 'adherent';
|
||||
}
|
||||
if ($element_type == 'cabinetmed_cons') {
|
||||
$classpath = 'cabinetmed/class';
|
||||
$module = 'cabinetmed';
|
||||
$subelement = 'cabinetmedcons';
|
||||
}
|
||||
if ($element_type == 'fichinter') {
|
||||
$classpath = 'fichinter/class';
|
||||
$module = 'ficheinter';
|
||||
$subelement = 'fichinter';
|
||||
}
|
||||
if ($element_type == 'dolresource' || $element_type == 'resource') {
|
||||
$classpath = 'resource/class';
|
||||
$module = 'resource';
|
||||
$subelement = 'dolresource';
|
||||
}
|
||||
if ($element_type == 'propaldet') {
|
||||
$classpath = 'comm/propal/class';
|
||||
$module = 'propal';
|
||||
$subelement = 'propaleligne';
|
||||
}
|
||||
if ($element_type == 'order_supplier') {
|
||||
$classpath = 'fourn/class';
|
||||
$module = 'fournisseur';
|
||||
$subelement = 'commandefournisseur';
|
||||
$classfile = 'fournisseur.commande';
|
||||
}
|
||||
if ($element_type == 'invoice_supplier') {
|
||||
$classpath = 'fourn/class';
|
||||
$module = 'fournisseur';
|
||||
$subelement = 'facturefournisseur';
|
||||
$classfile = 'fournisseur.facture';
|
||||
}
|
||||
if ($element_type == "service") {
|
||||
$classpath = 'product/class';
|
||||
$subelement = 'product';
|
||||
}
|
||||
|
||||
if (!isset($classfile)) $classfile = strtolower($subelement);
|
||||
if (!isset($classname)) $classname = ucfirst($subelement);
|
||||
if (!isset($classpath)) $classpath = $module.'/class';
|
||||
|
||||
$element_properties = array(
|
||||
'module' => $module,
|
||||
'classpath' => $classpath,
|
||||
'element' => $element,
|
||||
'subelement' => $subelement,
|
||||
'classfile' => $classfile,
|
||||
'classname' => $classname
|
||||
);
|
||||
return $element_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch an object from its id and element_type
|
||||
* Inclusion of classes is automatic
|
||||
*
|
||||
* @param int $element_id Element id
|
||||
* @param string $element_type Element type
|
||||
* @param string $element_ref Element ref (Use this or element_id but not both)
|
||||
* @return int|object object || 0 || -1 if error
|
||||
*/
|
||||
function fetchObjectByElement($element_id, $element_type, $element_ref = '')
|
||||
{
|
||||
global $conf, $db;
|
||||
|
||||
$element_prop = getElementProperties($element_type);
|
||||
if (is_array($element_prop) && $conf->{$element_prop['module']}->enabled)
|
||||
{
|
||||
dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');
|
||||
|
||||
$objecttmp = new $element_prop['classname']($db);
|
||||
$ret = $objecttmp->fetch($element_id, $element_ref);
|
||||
if ($ret >= 0)
|
||||
{
|
||||
return $objecttmp;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert an array with RGB value into hex RGB value.
|
||||
@ -2377,7 +2226,7 @@ function colorLighten($hex, $percent)
|
||||
/**
|
||||
* @param string $hex color in hex
|
||||
* @param float $alpha 0 to 1 to add alpha channel
|
||||
* @param bool $returnArray Array set to 1 to return an array instead of string
|
||||
* @param bool $returnArray true=return an array instead, false=return string
|
||||
* @return string|array String or array
|
||||
*/
|
||||
function colorHexToRgb($hex, $alpha = false, $returnArray = false)
|
||||
|
||||
@ -196,8 +196,13 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
// Get more permissions checks from hooks
|
||||
$parameters = array('features'=>$features, 'objectid'=>$objectid, 'idtype'=>$dbt_select);
|
||||
$reshook = $hookmanager->executeHooks('restrictedArea', $parameters);
|
||||
if (!empty($hookmanager->resArray['result'])) return true;
|
||||
if ($reshook > 0) return false;
|
||||
|
||||
if (isset($hookmanager->resArray['result'])) {
|
||||
if ($hookmanager->resArray['result'] == 0) accessforbidden(); // Module returns 0, so access forbidden
|
||||
}
|
||||
if ($reshook > 0) { // No other test done.
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($dbt_select != 'rowid' && $dbt_select != 'id') $objectid = "'".$objectid."'";
|
||||
|
||||
|
||||
@ -177,7 +177,8 @@ foreach(array('internal', 'external') as $source)
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$entry = '';
|
||||
$entry = new stdClass();
|
||||
|
||||
$entry->id = $tab[$i]['rowid'];
|
||||
$entry->type = $tab[$i]['libelle'];
|
||||
|
||||
|
||||
@ -206,9 +206,10 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
else
|
||||
{
|
||||
$error ="Failed to insert security event: ".$event->error;
|
||||
$this->errors[] = $error;
|
||||
$this->error=$error;
|
||||
|
||||
dol_syslog(get_class($this).": ".$this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this).": ".$error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -829,7 +829,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->sendtoid=0;
|
||||
}
|
||||
// TODO Merge all previous cases into this generic one
|
||||
else // $action = TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ...
|
||||
else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ...
|
||||
{
|
||||
// Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). Key can be set in agenda setup if defined into c_action_trigger
|
||||
// Load translation files required by the page
|
||||
|
||||
@ -137,7 +137,7 @@ if ($conf->use_javascript_ajax)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
|
||||
@ -1236,13 +1236,14 @@ class EmailCollector extends CommonObject
|
||||
// References: <1542377954.SMTPs-dolibarr-tic649@8f6014fde11ec6cdec9a822234fc557e>
|
||||
// References: <1542377954.SMTPs-dolibarr-abc649@8f6014fde11ec6cdec9a822234fc557e>
|
||||
$trackid = '';
|
||||
$objectid = 0;
|
||||
$objectemail = null;
|
||||
|
||||
$reg = array();
|
||||
if (!empty($headers['References']) && preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $headers['References'], $reg))
|
||||
{
|
||||
$trackid = $reg[1].$reg[2];
|
||||
|
||||
$objectid = 0;
|
||||
$objectemail = null;
|
||||
if ($reg[1] == 'inv')
|
||||
{
|
||||
$objectid = $reg[2];
|
||||
@ -1814,8 +1815,8 @@ class EmailCollector extends CommonObject
|
||||
|
||||
|
||||
'thirdpartyid' => $thirdpartyid ,
|
||||
'objectid'=>@$objectid,
|
||||
'objectemail'=>@$objectemail,
|
||||
'objectid'=> $objectid,
|
||||
'objectemail'=> $objectemail,
|
||||
|
||||
'messagetext'=>$messagetext,
|
||||
'subject'=>$subject,
|
||||
|
||||
@ -85,6 +85,7 @@ class Expedition extends CommonObject
|
||||
|
||||
/**
|
||||
* @var string internal ref
|
||||
* @deprecated
|
||||
*/
|
||||
public $ref_int;
|
||||
|
||||
@ -523,15 +524,15 @@ class Expedition extends CommonObject
|
||||
* @param int $id Id of object to load
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other object
|
||||
* @param string $notused Internal reference of other object
|
||||
* @return int >0 if OK, 0 if not found, <0 if KO
|
||||
*/
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $notused = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
|
||||
|
||||
$sql = "SELECT e.rowid, 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";
|
||||
@ -551,7 +552,7 @@ class Expedition extends CommonObject
|
||||
if ($id) $sql.= " AND e.rowid=".$id;
|
||||
if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql.= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'";
|
||||
if ($notused) $sql.= " AND e.ref_int='".$this->db->escape($notused)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -136,7 +136,7 @@ if ($conf->use_javascript_ajax)
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setHeight(350);
|
||||
$dolgraph->combine = empty($conf->global->MAIN_EXPENSEREPORT_COMBINE_GRAPH_STAT) ? 0.05 : $conf->global->MAIN_EXPENSEREPORT_COMBINE_GRAPH_STAT;
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
|
||||
@ -248,14 +248,14 @@ if ($action == 'create' || empty($action))
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Date").'</td><td colspan="2">';
|
||||
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
$datepaid = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int'));
|
||||
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaid):0;
|
||||
print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1);
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td colspan="2">';
|
||||
$form->select_types_paiements(isset($_POST["fk_typepayment"])?$_POST["fk_typepayment"]:$expensereport->fk_typepayment, "fk_typepayment");
|
||||
$form->select_types_paiements(GETPOSTISSET("fk_typepayment") ? GETPOST("fk_typepayment", 'alpha') : $expensereport->fk_c_paiement, "fk_typepayment");
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
@ -264,7 +264,7 @@ if ($action == 'create' || empty($action))
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
||||
print '<td colspan="2">';
|
||||
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '', 1); // Show open bank account list
|
||||
$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", "int") : $expensereport->accountid, "accountid", 0, '', 1); // Show open bank account list
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -243,10 +243,9 @@ class FichinterRec extends Fichinter
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref Reference of fichinter
|
||||
* @param string $ref_ext External reference of fichinter
|
||||
* @param int $ref_int Internal reference of other object
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
*/
|
||||
public function fetch($rowid = 0, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
public function fetch($rowid = 0, $ref = '', $ref_ext = '')
|
||||
{
|
||||
$sql = 'SELECT f.titre, f.fk_soc';
|
||||
$sql .= ', f.datec, f.duree, f.fk_projet, f.fk_contrat, f.description';
|
||||
@ -258,11 +257,6 @@ class FichinterRec extends Fichinter
|
||||
if ($rowid > 0) $sql .= ' WHERE f.rowid='.$rowid;
|
||||
elseif ($ref) $sql .= " WHERE f.titre='".$this->db->escape($ref)."'";
|
||||
|
||||
/* This field are not used for template fichinter
|
||||
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
|
||||
*/
|
||||
|
||||
dol_syslog(get_class($this)."::fetch rowid=".$rowid, LOG_DEBUG);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -191,10 +191,11 @@ class FichinterStats extends Stats
|
||||
/**
|
||||
* Return nb, amount of predefined product for year
|
||||
*
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
* @param int $year Year to scan
|
||||
* @param int $limit Limit
|
||||
* @return array Array of values
|
||||
*/
|
||||
public function getAllByProduct($year)
|
||||
public function getAllByProduct($year, $limit = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@ -208,6 +209,6 @@ class FichinterStats extends Stats
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql);
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ if ($resql)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION', '11.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
|
||||
if (! defined('EURO')) define('EURO', chr(128));
|
||||
|
||||
|
||||
@ -137,10 +137,10 @@ if ($resql)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
|
||||
|
||||
1
htdocs/includes/chart/.gitignore
vendored
1
htdocs/includes/chart/.gitignore
vendored
@ -1,7 +1,6 @@
|
||||
/_book
|
||||
/coverage
|
||||
/custom
|
||||
/dist
|
||||
/docs/index.md
|
||||
/gh-pages
|
||||
/jsdoc
|
||||
|
||||
20755
htdocs/includes/chart/dist/Chart.bundle.js
vendored
Normal file
20755
htdocs/includes/chart/dist/Chart.bundle.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
htdocs/includes/chart/dist/Chart.bundle.min.js
vendored
Normal file
7
htdocs/includes/chart/dist/Chart.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
47
htdocs/includes/chart/dist/Chart.css
vendored
Normal file
47
htdocs/includes/chart/dist/Chart.css
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* DOM element rendering detection
|
||||
* https://davidwalsh.name/detect-node-insertion
|
||||
*/
|
||||
@keyframes chartjs-render-animation {
|
||||
from { opacity: 0.99; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
.chartjs-render-monitor {
|
||||
animation: chartjs-render-animation 0.001s;
|
||||
}
|
||||
|
||||
/*
|
||||
* DOM element resizing detection
|
||||
* https://github.com/marcj/css-element-queries
|
||||
*/
|
||||
.chartjs-size-monitor,
|
||||
.chartjs-size-monitor-expand,
|
||||
.chartjs-size-monitor-shrink {
|
||||
position: absolute;
|
||||
direction: ltr;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
visibility: hidden;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.chartjs-size-monitor-expand > div {
|
||||
position: absolute;
|
||||
width: 1000000px;
|
||||
height: 1000000px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.chartjs-size-monitor-shrink > div {
|
||||
position: absolute;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
16151
htdocs/includes/chart/dist/Chart.js
vendored
Normal file
16151
htdocs/includes/chart/dist/Chart.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
htdocs/includes/chart/dist/Chart.min.css
vendored
Normal file
1
htdocs/includes/chart/dist/Chart.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
@keyframes chartjs-render-animation{from{opacity:.99}to{opacity:1}}.chartjs-render-monitor{animation:chartjs-render-animation 1ms}.chartjs-size-monitor,.chartjs-size-monitor-expand,.chartjs-size-monitor-shrink{position:absolute;direction:ltr;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1}.chartjs-size-monitor-expand>div{position:absolute;width:1000000px;height:1000000px;left:0;top:0}.chartjs-size-monitor-shrink>div{position:absolute;width:200%;height:200%;left:0;top:0}
|
||||
7
htdocs/includes/chart/dist/Chart.min.js
vendored
Normal file
7
htdocs/includes/chart/dist/Chart.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -29,11 +29,11 @@
|
||||
--
|
||||
-- Sending method
|
||||
--
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (1,'CATCH','In-Store Collection','In-store collection by the customer','',1);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (2,'TRANS','Courier Service','Courier Service','',1);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi','https://www.laposte.fr/outils/suivre-vos-envois?code={TRACKID}',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (4,'LETTREMAX','Lettre Max','Courrier Suivi et Lettre Max','https://www.laposte.fr/outils/suivre-vos-envois?code={TRACKID}',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (5,'UPS','UPS','United Parcel Service','http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber2=&InquiryNumber3=&tracknums_displayed=3&loc=fr_FR&TypeOfInquiryNumber=T&HTMLVersion=4.0&InquiryNumber22=&InquiryNumber32=&track=Track&Suivi.x=64&Suivi.y=7&Suivi=Valider&InquiryNumber1={TRACKID}',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (6,'KIALA','KIALA','Relais Kiala','http://www.kiala.fr/tnt/delivery/{TRACKID}',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (7,'GLS','GLS','General Logistics Systems','https://gls-group.eu/FR/fr/suivi-colis?match={TRACKID}',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (8,'CHRONO','Chronopost','Chronopost','http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?listeNumeros={TRACKID}',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (1,'CATCH','In-Store Collection','In-store collection by the customer', '', 1);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (2,'TRANS','Generic transport service','Generic transport service', '', 1);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi','https://www.laposte.fr/outils/suivre-vos-envois?code={TRACKID}', 0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (4,'LETTREMAX','Lettre Max','Courrier Suivi et Lettre Max','https://www.laposte.fr/outils/suivre-vos-envois?code={TRACKID}', 0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (5,'UPS','UPS','United Parcel Service','http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber2=&InquiryNumber3=&tracknums_displayed=3&loc=fr_FR&TypeOfInquiryNumber=T&HTMLVersion=4.0&InquiryNumber22=&InquiryNumber32=&track=Track&Suivi.x=64&Suivi.y=7&Suivi=Valider&InquiryNumber1={TRACKID}', 1);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (6,'KIALA','KIALA','Relais Kiala','http://www.kiala.fr/tnt/delivery/{TRACKID}', 0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (7,'GLS','GLS','General Logistics Systems','https://gls-group.eu/FR/fr/suivi-colis?match={TRACKID}', 0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (8,'CHRONO','Chronopost','Chronopost','http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?listeNumeros={TRACKID}', 0);
|
||||
|
||||
@ -5070,15 +5070,15 @@ function migrate_members_socialnetworks()
|
||||
print '<tr><td colspan="4">';
|
||||
$sql = 'SELECT rowid, socialnetworks';
|
||||
$sql .= ', skype, twitter, facebook, linkedin, instagram, snapchat, googleplus, youtube, whatsapp FROM '.MAIN_DB_PREFIX.'adherent WHERE ';
|
||||
$sql .= ' skype IS NOT NULL OR skype!=""';
|
||||
$sql .= ' OR twitter IS NOT NULL OR twitter!=""';
|
||||
$sql .= ' OR facebook IS NOT NULL OR facebook!=""';
|
||||
$sql .= ' OR linkedin IS NOT NULL OR linkedin!=""';
|
||||
$sql .= ' OR instagram IS NOT NULL OR instagram!=""';
|
||||
$sql .= ' OR snapchat IS NOT NULL OR snapchat!=""';
|
||||
$sql .= ' OR googleplus IS NOT NULL OR googleplus!=""';
|
||||
$sql .= ' OR youtube IS NOT NULL OR youtube!=""';
|
||||
$sql .= ' OR whatsapp IS NOT NULL OR whatsapp!=""';
|
||||
$sql .= " skype IS NOT NULL OR skype <> ''";
|
||||
$sql .= " OR twitter IS NOT NULL OR twitter <> ''";
|
||||
$sql .= " OR facebook IS NOT NULL OR facebook <> ''";
|
||||
$sql .= " OR linkedin IS NOT NULL OR linkedin <> ''";
|
||||
$sql .= " OR instagram IS NOT NULL OR instagram <> ''";
|
||||
$sql .= " OR snapchat IS NOT NULL OR snapchat <> ''";
|
||||
$sql .= " OR googleplus IS NOT NULL OR googleplus <> ''";
|
||||
$sql .= " OR youtube IS NOT NULL OR youtube <> ''";
|
||||
$sql .= " OR whatsapp IS NOT NULL OR whatsapp <> ''";
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
@ -5160,16 +5160,16 @@ function migrate_contacts_socialnetworks()
|
||||
print '<tr><td colspan="4">';
|
||||
$sql = 'SELECT rowid, socialnetworks';
|
||||
$sql .= ', jabberid, skype, twitter, facebook, linkedin, instagram, snapchat, googleplus, youtube, whatsapp FROM '.MAIN_DB_PREFIX.'socpeople WHERE ';
|
||||
$sql .= ' jabberid IS NOT NULL OR jabberid!=""';
|
||||
$sql .= ' OR skype IS NOT NULL OR skype!=""';
|
||||
$sql .= ' OR twitter IS NOT NULL OR twitter!=""';
|
||||
$sql .= ' OR facebook IS NOT NULL OR facebook!=""';
|
||||
$sql .= ' OR linkedin IS NOT NULL OR linkedin!=""';
|
||||
$sql .= ' OR instagram IS NOT NULL OR instagram!=""';
|
||||
$sql .= ' OR snapchat IS NOT NULL OR snapchat!=""';
|
||||
$sql .= ' OR googleplus IS NOT NULL OR googleplus!=""';
|
||||
$sql .= ' OR youtube IS NOT NULL OR youtube!=""';
|
||||
$sql .= ' OR whatsapp IS NOT NULL OR whatsapp!=""';
|
||||
$sql .= " jabberid IS NOT NULL OR jabberid <> ''";
|
||||
$sql .= " OR skype IS NOT NULL OR skype <> ''";
|
||||
$sql .= " OR twitter IS NOT NULL OR twitter <> ''";
|
||||
$sql .= " OR facebook IS NOT NULL OR facebook <> ''";
|
||||
$sql .= " OR linkedin IS NOT NULL OR linkedin <> ''";
|
||||
$sql .= " OR instagram IS NOT NULL OR instagram <> ''";
|
||||
$sql .= " OR snapchat IS NOT NULL OR snapchat <> ''";
|
||||
$sql .= " OR googleplus IS NOT NULL OR googleplus <> ''";
|
||||
$sql .= " OR youtube IS NOT NULL OR youtube <> ''";
|
||||
$sql .= " OR whatsapp IS NOT NULL OR whatsapp <> ''";
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
@ -5255,15 +5255,15 @@ function migrate_thirdparties_socialnetworks()
|
||||
print '<tr><td colspan="4">';
|
||||
$sql = 'SELECT rowid, socialnetworks';
|
||||
$sql .= ', skype, twitter, facebook, linkedin, instagram, snapchat, googleplus, youtube, whatsapp FROM '.MAIN_DB_PREFIX.'societe WHERE ';
|
||||
$sql .= ' skype IS NOT NULL OR skype!=""';
|
||||
$sql .= ' OR twitter IS NOT NULL OR twitter!=""';
|
||||
$sql .= ' OR facebook IS NOT NULL OR facebook!=""';
|
||||
$sql .= ' OR linkedin IS NOT NULL OR linkedin!=""';
|
||||
$sql .= ' OR instagram IS NOT NULL OR instagram!=""';
|
||||
$sql .= ' OR snapchat IS NOT NULL OR snapchat!=""';
|
||||
$sql .= ' OR googleplus IS NOT NULL OR googleplus!=""';
|
||||
$sql .= ' OR youtube IS NOT NULL OR youtube!=""';
|
||||
$sql .= ' OR whatsapp IS NOT NULL OR whatsapp!=""';
|
||||
$sql .= " skype IS NOT NULL OR skype <> ''";
|
||||
$sql .= " OR twitter IS NOT NULL OR twitter <> ''";
|
||||
$sql .= " OR facebook IS NOT NULL OR facebook <> ''";
|
||||
$sql .= " OR linkedin IS NOT NULL OR linkedin <> ''";
|
||||
$sql .= " OR instagram IS NOT NULL OR instagram <> ''";
|
||||
$sql .= " OR snapchat IS NOT NULL OR snapchat <> ''";
|
||||
$sql .= " OR googleplus IS NOT NULL OR googleplus <> ''";
|
||||
$sql .= " OR youtube IS NOT NULL OR youtube <> ''";
|
||||
$sql .= " OR whatsapp IS NOT NULL OR whatsapp <> ''";
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@ -21,11 +21,11 @@ BoxFicheInter=Latest interventions
|
||||
BoxCurrentAccounts=ميزان الحسابات المفتوحة
|
||||
BoxTitleMemberNextBirthdays=Birthdays of this month (members)
|
||||
BoxTitleLastRssInfos=Latest %s news from %s
|
||||
BoxTitleLastProducts=Products/Services: last %s modified
|
||||
BoxTitleLastProducts=Products/Services: latest %s modified
|
||||
BoxTitleProductsAlertStock=Products: stock alert
|
||||
BoxTitleLastSuppliers=Latest %s recorded suppliers
|
||||
BoxTitleLastModifiedSuppliers=Vendors: last %s modified
|
||||
BoxTitleLastModifiedCustomers=Customers: last %s modified
|
||||
BoxTitleLastModifiedSuppliers=Vendors: latest %s modified
|
||||
BoxTitleLastModifiedCustomers=Customers: latest %s modified
|
||||
BoxTitleLastCustomersOrProspects=Latest %s customers or prospects
|
||||
BoxTitleLastCustomerBills=Latest %s Customer invoices
|
||||
BoxTitleLastSupplierBills=Latest %s Vendor invoices
|
||||
|
||||
@ -84,6 +84,7 @@ InterventionSentByEMail=Intervention %s sent by email
|
||||
ProposalDeleted=Proposal deleted
|
||||
OrderDeleted=Order deleted
|
||||
InvoiceDeleted=Invoice deleted
|
||||
DraftInvoiceDeleted=Draft invoice deleted
|
||||
PRODUCT_CREATEInDolibarr=Product %s created
|
||||
PRODUCT_MODIFYInDolibarr=Product %s modified
|
||||
PRODUCT_DELETEInDolibarr=Product %s deleted
|
||||
|
||||
@ -66,9 +66,9 @@ paymentInInvoiceCurrency=in invoices currency
|
||||
PaidBack=Paid back
|
||||
DeletePayment=Delete payment
|
||||
ConfirmDeletePayment=Are you sure you want to delete this payment?
|
||||
ConfirmConvertToReduc=Do you want to convert this %s into an absolute discount?
|
||||
ConfirmConvertToReduc=Do you want to convert this %s into an available credit?
|
||||
ConfirmConvertToReduc2=The amount will be saved among all discounts and could be used as a discount for a current or a future invoice for this customer.
|
||||
ConfirmConvertToReducSupplier=Do you want to convert this %s into an absolute discount?
|
||||
ConfirmConvertToReducSupplier=Do you want to convert this %s into an available credit?
|
||||
ConfirmConvertToReducSupplier2=The amount will be saved among all discounts and could be used as a discount for a current or a future invoice for this vendor.
|
||||
SupplierPayments=Vendor payments
|
||||
ReceivedPayments=Received payments
|
||||
|
||||
@ -233,6 +233,8 @@ ErrorLanguageMandatoryIfPageSetAsTranslationOfAnother=Error, language is mandato
|
||||
ErrorLanguageOfTranslatedPageIsSameThanThisPage=Error, language of translated page is same than this one.
|
||||
ErrorBatchNoFoundForProductInWarehouse=No lot/serial found for product "%s" in warehouse "%s".
|
||||
ErrorBatchNoFoundEnoughQuantityForProductInWarehouse=No enough quantity for this lot/serial for product "%s" in warehouse "%s".
|
||||
ErrorOnlyOneFieldForGroupByIsPossible=Only 1 field for the 'Group by' is possible (others are discarded)
|
||||
ErrorTooManyDifferentValueForSelectedGroupBy=Found too many different value (more than <b>%s</b>) for the field '<b>%s</b>', so we can't user it as a 'Group by' for graphics. The field 'Group By' has been removed. May be you wanted to use it as an X-Axis ?
|
||||
# Warnings
|
||||
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
|
||||
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.
|
||||
|
||||
@ -30,7 +30,7 @@ PreviousYearOfInvoice=Previous year of invoice date
|
||||
NextYearOfInvoice=Following year of invoice date
|
||||
DateNextInvoiceBeforeGen=Date of next invoice (before generation)
|
||||
DateNextInvoiceAfterGen=Date of next invoice (after generation)
|
||||
GraphInBarsAreLimitedTo3Measures=Grapics are limited to 3 measures in 'Bars' mode. The mode 'Lines' was automatically selected instead.
|
||||
GraphInBarsAreLimitedToNMeasures=Grapics are limited to %s measures in 'Bars' mode. The mode 'Lines' was automatically selected instead.
|
||||
OnlyOneFieldForXAxisIsPossible=Only 1 field is currently possible as X-Axis. Only the first selected field has been selected.
|
||||
AtLeastOneMeasureIsRequired=At least 1 field for measure is required
|
||||
AtLeastOneXAxisIsRequired=At least 1 field for X-Axis is required
|
||||
|
||||
@ -279,5 +279,33 @@ class ActionsMyModule
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Overloading the restrictedArea function : check permission on an object
|
||||
*
|
||||
* @param array $parameters Hook metadatas (context, etc...)
|
||||
* @param string $action Current action (if set). Generally create or edit or null
|
||||
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
|
||||
* @return int <0 if KO,
|
||||
* =0 if OK but we want to process standard actions too,
|
||||
* >0 if OK and we want to replace standard actions.
|
||||
*/
|
||||
public function restrictedArea($parameters, &$action, $hookmanager)
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ($parameters['features'] == 'myobject') {
|
||||
if ($user->rights->mymodule->myobject->read) {
|
||||
$this->results['result'] = 1;
|
||||
return 1;
|
||||
} else {
|
||||
$this->results['result'] = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Add here any other hooked methods... */
|
||||
}
|
||||
|
||||
@ -101,10 +101,10 @@ if ($conf->use_javascript_ajax)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->SetHeight(200);
|
||||
$dolgraph->SetHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($totalnb?0:1);
|
||||
|
||||
|
||||
@ -174,13 +174,13 @@ if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($us
|
||||
{
|
||||
$dataseries[] = array($langs->trans("ServicesOnSale"), round($SommeD));
|
||||
$dataseries[] = array($langs->trans("ServicesOnPurchase"), round($SommeE));
|
||||
$dataseries[] = array($langs->trans("ServicesNotOnSell"), round($SommeF));
|
||||
$dataseries[] = array(dol_trunc($langs->trans("ServicesNotOnSell"), 24), round($SommeF));
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(0);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
@ -241,10 +241,10 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idstatscategproduct');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
}
|
||||
|
||||
@ -355,6 +355,7 @@ if ($result || empty($id))
|
||||
$px->SetYLabel($graphfiles[$key]['label']);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue() < 0 ? 0 : $px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue() > 0 ? 0 : $px->GetFloorMinValue());
|
||||
$px->setShowLegend(0);
|
||||
$px->SetWidth($WIDTH);
|
||||
$px->SetHeight($HEIGHT);
|
||||
$px->SetHorizTickIncrement(1);
|
||||
|
||||
@ -80,7 +80,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
//$dolgraph->setWidth('100%');
|
||||
|
||||
@ -771,9 +771,7 @@ while ($i < min($num, $limit))
|
||||
$nbofsalesrepresentative = count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) // We print only number
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$socstatic->id.'">';
|
||||
print $nbofsalesrepresentative;
|
||||
print '</a>';
|
||||
}
|
||||
elseif ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
|
||||
@ -68,11 +68,12 @@ if (GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha')) {
|
||||
|
||||
// Set tmp directory TODO Use a dedicated directory for temp mails files
|
||||
$vardir = $conf->ticket->dir_output;
|
||||
$upload_dir_tmp = $vardir.'/temp';
|
||||
$upload_dir_tmp = $vardir.'/temp/'.session_id();
|
||||
if (!dol_is_dir($upload_dir_tmp)) {
|
||||
dol_mkdir($upload_dir_tmp);
|
||||
}
|
||||
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile');
|
||||
|
||||
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, '', 0);
|
||||
$action = 'create_ticket';
|
||||
////}
|
||||
}
|
||||
@ -83,7 +84,7 @@ if (GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha')) {
|
||||
|
||||
// Set tmp directory
|
||||
$vardir = $conf->ticket->dir_output.'/';
|
||||
$upload_dir_tmp = $vardir.'/temp';
|
||||
$upload_dir_tmp = $vardir.'/temp/'.session_id();
|
||||
|
||||
// TODO Delete only files that was uploaded from email form
|
||||
dol_remove_file_process($_POST['removedfile'], 0, 0);
|
||||
@ -170,7 +171,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
||||
|
||||
if (!$error && $id > 0) {
|
||||
if ($usertoassign > 0) {
|
||||
$object->add_contact($usertoassign, "SUPPORTCLI", 'external', $notrigger = 0);
|
||||
$object->add_contact($usertoassign, "SUPPORTCLI", 'external', 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,7 +305,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
||||
}
|
||||
|
||||
// Copy files into ticket directory
|
||||
$destdir = $conf->ticket->dir_output.'/'.$object->track_id;
|
||||
$destdir = $conf->ticket->dir_output.'/'.$object->ref;
|
||||
if (!dol_is_dir($destdir)) {
|
||||
dol_mkdir($destdir);
|
||||
}
|
||||
|
||||
@ -56,7 +56,13 @@ class Reception extends CommonObject
|
||||
|
||||
public $socid;
|
||||
public $ref_supplier;
|
||||
|
||||
/**
|
||||
* @var int Ref int
|
||||
* @deprecated
|
||||
*/
|
||||
public $ref_int;
|
||||
|
||||
public $brouillon;
|
||||
public $entrepot_id;
|
||||
public $lines = array();
|
||||
@ -372,15 +378,15 @@ class Reception extends CommonObject
|
||||
* @param int $id Id of object to load
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other object
|
||||
* @param string $notused Internal reference of other object
|
||||
* @return int >0 if OK, 0 if not found, <0 if KO
|
||||
*/
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $notused = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
|
||||
|
||||
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_supplier, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut";
|
||||
$sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
|
||||
@ -397,7 +403,7 @@ class Reception extends CommonObject
|
||||
if ($id) $sql .= " AND e.rowid=".$id;
|
||||
if ($ref) $sql .= " AND e.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql .= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql .= " AND e.ref_int='".$this->db->escape($ref_int)."'";
|
||||
if ($notused) $sql .= " AND e.ref_int='".$this->db->escape($notused)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -306,9 +306,7 @@ abstract class ActionsCardCommon
|
||||
$nbofsalesrepresentative=count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) // We print only number
|
||||
{
|
||||
$this->tpl['sales_representatives'].= '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->id.'">';
|
||||
$this->tpl['sales_representatives'].= $nbofsalesrepresentative;
|
||||
$this->tpl['sales_representatives'].= '</a>';
|
||||
}
|
||||
elseif ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
|
||||
@ -134,7 +134,7 @@ class Societe extends CommonObject
|
||||
'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name alias', 'enabled'=>1, 'visible'=>-1, 'position'=>36, 'showoncombobox'=>1),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>45),
|
||||
'ref_int' =>array('type'=>'varchar(60)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
|
||||
'ref_int' =>array('type'=>'varchar(60)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>50), // deprecated
|
||||
'code_client' =>array('type'=>'varchar(24)', 'label'=>'Code client', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'code_fournisseur' =>array('type'=>'varchar(24)', 'label'=>'Code fournisseur', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'code_compta' =>array('type'=>'varchar(24)', 'label'=>'Code compta', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
@ -625,13 +625,13 @@ class Societe extends CommonObject
|
||||
|
||||
/**
|
||||
* @var string Internal ref
|
||||
* @deprecated
|
||||
*/
|
||||
public $ref_int;
|
||||
|
||||
/**
|
||||
* External user reference.
|
||||
* This is to allow external systems to store their id and make self-developed synchronizing functions easier to
|
||||
* build.
|
||||
* This is to allow external systems to store their id and make self-developed synchronizing functions easier to build.
|
||||
* @var string
|
||||
*/
|
||||
public $ref_ext;
|
||||
@ -1454,7 +1454,7 @@ class Societe extends CommonObject
|
||||
* @param int $rowid Id of third party to load
|
||||
* @param string $ref Reference of third party, name (Warning, this can return several records)
|
||||
* @param string $ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr)
|
||||
* @param string $ref_int Internal reference of third party (not used by dolibarr)
|
||||
* @param string $notused Not used
|
||||
* @param string $idprof1 Prof id 1 of third party (Warning, this can return several records)
|
||||
* @param string $idprof2 Prof id 2 of third party (Warning, this can return several records)
|
||||
* @param string $idprof3 Prof id 3 of third party (Warning, this can return several records)
|
||||
@ -1465,12 +1465,12 @@ class Societe extends CommonObject
|
||||
* @param string $ref_alias Name_alias of third party (Warning, this can return several records)
|
||||
* @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found.
|
||||
*/
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $idprof1 = '', $idprof2 = '', $idprof3 = '', $idprof4 = '', $idprof5 = '', $idprof6 = '', $email = '', $ref_alias = '')
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '', $notused = '', $idprof1 = '', $idprof2 = '', $idprof3 = '', $idprof4 = '', $idprof5 = '', $idprof6 = '', $email = '', $ref_alias = '')
|
||||
{
|
||||
global $langs;
|
||||
global $conf;
|
||||
|
||||
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6) && empty($email)) return -1;
|
||||
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6) && empty($email)) return -1;
|
||||
|
||||
$sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm';
|
||||
$sql .= ', s.status';
|
||||
@ -1515,7 +1515,7 @@ class Societe extends CommonObject
|
||||
if ($ref) $sql .= " AND s.nom = '".$this->db->escape($ref)."'";
|
||||
if ($ref_alias) $sql .= " AND s.name_alias = '".$this->db->escape($ref_alias)."'";
|
||||
if ($ref_ext) $sql .= " AND s.ref_ext = '".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql .= " AND s.ref_int = '".$this->db->escape($ref_int)."'";
|
||||
if ($notused) $sql .= " AND s.ref_int = '".$this->db->escape($notused)."'";
|
||||
if ($idprof1) $sql .= " AND s.siren = '".$this->db->escape($idprof1)."'";
|
||||
if ($idprof2) $sql .= " AND s.siret = '".$this->db->escape($idprof2)."'";
|
||||
if ($idprof3) $sql .= " AND s.ape = '".$this->db->escape($idprof3)."'";
|
||||
|
||||
@ -112,7 +112,7 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) +
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
@ -200,10 +200,10 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphcateg');
|
||||
print $dolgraph->show();
|
||||
}
|
||||
|
||||
@ -542,7 +542,6 @@ $param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($search_all != '') $param = "&sall=".urlencode($search_all);
|
||||
if ($sall != '') $param .= "&sall=".urlencode($sall);
|
||||
if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus);
|
||||
if ($search_categ_sup > 0) $param .= '&search_categ_sup='.urlencode($search_categ_sup);
|
||||
if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
|
||||
|
||||
@ -144,7 +144,7 @@ if ($resql)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
|
||||
@ -77,7 +77,6 @@ if (GETPOST('action', 'alpha') == 'set') {
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_CUSTOM_RECEIPT", GETPOST('TAKEPOS_CUSTOM_RECEIPT', 'int'), 'int', 0, '', $conf->entity);
|
||||
//$res = dolibarr_set_const($db, "TAKEPOS_HEAD_BAR", GETPOST('TAKEPOS_HEAD_BAR', 'int'), 'int', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) {
|
||||
|
||||
@ -79,7 +79,6 @@ if (GETPOST('action', 'alpha') == 'set')
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_CUSTOM_RECEIPT", GETPOST('TAKEPOS_CUSTOM_RECEIPT', 'int'), 'int', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_ADDON", GETPOST('TAKEPOS_ADDON', 'alpha'), 'int', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) {
|
||||
|
||||
@ -226,7 +226,8 @@ if ($action == 'valid' && $user->rights->facture->creer)
|
||||
$payment->amounts[$invoice->id] = $amountofpayment;
|
||||
|
||||
// If user has not used change control, add total invoice payment
|
||||
if ($amountofpayment == 0) $payment->amounts[$invoice->id] = $remaintopay;
|
||||
// Or if user has used change control and the amount of payment is higher than remain to pay, add the remain to pay
|
||||
if ($amountofpayment == 0 || $amountofpayment>$remaintopay) $payment->amounts[$invoice->id] = $remaintopay;
|
||||
|
||||
$payment->paiementid = $paiementid;
|
||||
$payment->num_payment = $invoice->ref;
|
||||
|
||||
@ -85,31 +85,27 @@ if (!empty($hookmanager->resPrint)) {
|
||||
<br>
|
||||
<p class="left">
|
||||
<?php
|
||||
if ($conf->global->TAKEPOS_CUSTOM_RECEIPT)
|
||||
if (!empty($conf->global->TAKEPOS_HEADER))
|
||||
{
|
||||
$substitutionarray = getCommonSubstitutionArray($langs);
|
||||
if (!empty($conf->global->TAKEPOS_HEADER))
|
||||
{
|
||||
$newfreetext = make_substitutions($conf->global->TAKEPOS_HEADER, $substitutionarray);
|
||||
echo $newfreetext;
|
||||
}
|
||||
$newfreetext = make_substitutions($conf->global->TAKEPOS_HEADER, $substitutionarray);
|
||||
echo $newfreetext;
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p class="right">
|
||||
<?php
|
||||
print $langs->trans('Date')." ".dol_print_date($object->date, 'day').'<br>';
|
||||
if ($conf->global->TAKEPOS_CUSTOM_RECEIPT) print $conf->global->TAKEPOS_RECEIPT_NAME." ";
|
||||
if (!empty($conf->global->TAKEPOS_RECEIPT_NAME)) print $conf->global->TAKEPOS_RECEIPT_NAME." ";
|
||||
if ($object->statut == Facture::STATUS_DRAFT) print str_replace(")", "", str_replace("-", " ".$langs->trans('Place')." ", str_replace("(PROV-POS", $langs->trans("Terminal")." ", $object->ref)));
|
||||
else print $object->ref;
|
||||
if ($conf->global->TAKEPOS_CUSTOM_RECEIPT && $conf->global->TAKEPOS_SHOW_CUSTOMER)
|
||||
if ($conf->global->TAKEPOS_SHOW_CUSTOMER)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($invoice->socid);
|
||||
if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]})
|
||||
if ($object->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]})
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
if ($invoice->socid > 0) $soc->fetch($invoice->socid);
|
||||
if ($object->socid > 0) $soc->fetch($object->socid);
|
||||
else $soc->fetch($conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]});
|
||||
print "<br>".$langs->trans("Customer").': '.$soc->name;
|
||||
}
|
||||
@ -183,13 +179,11 @@ if ($conf->global->TAKEPOS_CUSTOM_RECEIPT && $conf->global->TAKEPOS_SHOW_CUSTOME
|
||||
<br>
|
||||
<br>
|
||||
<?php
|
||||
if ($conf->global->TAKEPOS_CUSTOM_RECEIPT)
|
||||
if (!empty($conf->global->TAKEPOS_FOOTER))
|
||||
{
|
||||
$substitutionarray = getCommonSubstitutionArray($langs);
|
||||
if (!empty($conf->global->TAKEPOS_FOOTER)) {
|
||||
$newfreetext = make_substitutions($conf->global->TAKEPOS_FOOTER, $substitutionarray);
|
||||
echo $newfreetext;
|
||||
}
|
||||
$newfreetext = make_substitutions($conf->global->TAKEPOS_FOOTER, $substitutionarray);
|
||||
echo $newfreetext;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@ -2348,7 +2348,8 @@ input.vmenusearchselectcombo[type=text] {
|
||||
|
||||
|
||||
a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active, span.vmenu, span.vsmenu { white-space: nowrap; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; }
|
||||
a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { font-weight: bold; } /* bold = 600, 500 is ko with Edge on 1200x960 */
|
||||
a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active,
|
||||
span.vmenu, span.vmenu:link, span.vmenu:visited, span.vmenu:hover, span.vmenu:active { font-weight: bold; } /* bold = 600, 500 is ko with Edge on 1200x960 */
|
||||
font.vmenudisabled { font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: bold; color: #aaa; margin-left: 4px; } /* bold = 600, 500 is ko with Edge on 1200x960 */
|
||||
a.vmenu:link, a.vmenu:visited { color: var(--colortextbackvmenu); }
|
||||
|
||||
|
||||
@ -239,6 +239,7 @@ if (!empty($dataseries) && count($dataseries) > 1) {
|
||||
$legend[] = $i;
|
||||
$i++;
|
||||
}
|
||||
$px1->setShowLegend(2);
|
||||
$px1->SetType(array('pie'));
|
||||
$px1->SetLegend($legend);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||
|
||||
@ -304,7 +304,8 @@ class User extends CommonObject
|
||||
$sql .= " u.color,";
|
||||
$sql .= " u.dateemployment, u.dateemploymentend,";
|
||||
$sql .= " u.fk_warehouse,";
|
||||
$sql .= " u.ref_int, u.ref_ext,";
|
||||
$sql .= " u.ref_int,";
|
||||
$sql .= " u.ref_ext,";
|
||||
$sql .= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode
|
||||
$sql .= " c.code as country_code, c.label as country,";
|
||||
$sql .= " d.code_departement as state_code, d.nom as state";
|
||||
|
||||
@ -1267,9 +1267,7 @@ class Website extends CommonObject
|
||||
*/
|
||||
public function isMultiLang()
|
||||
{
|
||||
// TODO Can edit list of languages of web site. Return false if there is only 0 or 1 language.
|
||||
|
||||
return true;
|
||||
return (empty($this->otherlang) ? false : true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user