Commit 6bdb4c34 authored by Francesco Iannuzzelli's avatar Francesco Iannuzzelli

Merge branch 'master' of gitlab.com:peacelink/phpeace

parents 8d09d384 e0e46033
......@@ -1446,8 +1446,13 @@ class IRL
switch ($params['subtype'])
{
case "contractors":
case "contractor":
$path .= "contractors.php?" . ($params['id']>0? "id={$params['id']}":"");
break;
case "offices":
case "office":
$path .= "offices.php?" . ($params['id']>0? "id={$params['id']}":"");
break;
case "search":
$path .= "search.php";
if ($params['q']!="")
......
......@@ -2289,13 +2289,49 @@ class Layout
{
case "home":
break;
case "contract":
$contract = $dodc->ContractGet($params['id']);
if(isset($contract['id_contract'])) {
$contract['xname'] = 'dodc_contract';
$contractor = $dodc->ContractorGet($contract['id_contractor']);
$contractor['xname'] = 'dodc_contractor';
$this->Urlify($contractor,"dodc",array('subtype'=>'contractor','id' => $contractor['id_contractor']),true);
$contract['contractor'] = $contractor;
$office = $dodc->OfficeGet($contract['id_office']);
$office['xname'] = 'dodc_office';
$this->Urlify($office,"dodc",array('subtype'=>'office','id' => $office['id_office']),true);
$contract['office'] = $office;
}
$pdodc['contract'] = $contract;
break;
case "contractor":
$contractors = array();
$this->Urlify($contractors,"dodc",array('subtype'=>'contractors'),true);
$contractor = $dodc->ContractorGet($params['id']);
if(isset($contractor['id_contractor'])) {
$pparams['id'] = $contractor['id_contractor'];
$this->Urlify($contractor,"dodc",$pparams,true);
$contractor['xname'] = 'dodc_contractor';
$rows = array();
$num = $dodc->Contracts( $rows, $contractor['id_contractor'], true );
array_walk($rows, function(&$item){
$item['type'] = $item['item_type'] = 'dodc_contract';
$item['iamount'] = number_format($item['iamount'],0);
$item['xname'] = 'item';
return;
});
$contractor['items'] = $this->Page($rows,$num);
}
$pdodc['contractors'] = $contractors;
$pdodc['contractor'] = $contractor;
break;
case "contractors":
$contractors = array();
$this->Urlify($contractors,"dodc",$pparams,true);
$rows = array();
$num = $dodc->Contractors( $rows, 'IT' );
array_walk($rows, function(&$item){
$item['type'] = 'dodc_contractor';
$item['type'] = $item['item_type'] = 'dodc_contractor';
$item['total'] = number_format($item['total'],0);
$item['xname'] = 'item';
return;
......@@ -2303,6 +2339,42 @@ class Layout
$contractors['items'] = $this->Page($rows,$num);
$pdodc['contractors'] = $contractors;
break;
case "office":
$offices = array();
$this->Urlify($offices,"dodc",array('subtype'=>'offices'),true);
$office = $dodc->OfficeGet($params['id']);
if(isset($office['id_office'])) {
$pparams['id'] = $office['id_office'];
$this->Urlify($office,"dodc",$pparams,true);
$office['total'] = number_format($office['total'],0);
$office['xname'] = 'dodc_office';
$rows = array();
$num = $dodc->ContractsOffice( $rows, 0, $office['id_office'], true );
array_walk($rows, function(&$item){
$item['type'] = $item['item_type'] = 'dodc_contract';
$item['iamount'] = number_format($item['iamount'],0);
$item['xname'] = 'item';
return;
});
$office['items'] = $this->Page($rows,$num);
}
$pdodc['offices'] = $offices;
$pdodc['office'] = $office;
break;
case "offices":
$offices = array();
$this->Urlify($offices,"dodc",$pparams,true);
$rows = array();
$num = $dodc->Offices($rows);
array_walk($rows, function(&$item){
$item['type'] = 'dodc_office';
$item['total'] = number_format($item['total'],0);
$item['xname'] = 'item';
return;
});
$offices['items'] = $this->Page($rows,$num);
$pdodc['offices'] = $offices;
break;
}
$db =& Db::globaldb();
$db->select_db($this->conf->Get("dbconf")['database']);
......@@ -4820,6 +4892,12 @@ class Layout
case "campaign":
$label = $this->tr->Translate("campaigns");
break;
case "dodc_contractor":
$label = "Fornitori";
break;
case "dodc_contract":
$label = "Contratti";
break;
case "forum":
$label = $this->tr->Translate("forums");
break;
......@@ -4838,9 +4916,6 @@ class Layout
case "quote":
$label = $this->tr->Translate("quotes");
break;
case "dodc_contractor":
$label = "Fornitori";
break;
case "thread":
$label = $this->tr->Translate("threads");
break;
......
......@@ -272,16 +272,16 @@ class DodContractors
FROM contracts c
INNER JOIN categories ca ON c.id_category=ca.id_category
INNER JOIN contractors ct ON c.id_contractor=ct.id_contractor
WHERE c.id_parent=$id_contractor AND c.id_office=$id_office
ORDER BY c.start_date DESC ";
WHERE c.id_office=$id_office " . ($id_contractor>0? " AND c.id_contractor=$id_contractor":"")
. " ORDER BY c.start_date DESC ";
}
else
{
$sqlstr = " SELECT c.*,UNIX_TIMESTAMP(c.start_date) AS start_date_ts,ca.description
FROM contracts c
INNER JOIN categories ca ON c.id_category=ca.id_category
WHERE c.id_contractor=$id_contractor AND c.id_office=$id_office
ORDER BY c.start_date DESC ";
WHERE c.id_office=$id_office " . ($id_contractor>0? " AND c.id_contractor=$id_contractor":"")
. " ORDER BY c.start_date DESC ";
}
$db =& Db::globaldb();
$this->SelectDb();
......@@ -968,10 +968,12 @@ class DodContractors
public function OfficeGet($id_office)
{
$sqlstr = "SELECT o.id_office,o.code,o.name,o.fips,f.description,f.agency
$sqlstr = "SELECT o.id_office,o.code,o.name,o.fips,f.description,f.agency,SUM(c.iamount) AS total,COUNT(c.id_contract) AS counter
FROM offices o
INNER JOIN fips f ON o.fips=f.code
WHERE o.id_office='$id_office' ";
INNER JOIN contracts c ON o.id_office=c.id_office
WHERE o.id_office='$id_office'
GROUP BY o.id_office";
$row = array();
$db =& Db::globaldb();
$this->SelectDb();
......
<?php
/********************************************************************
PhPeace - Portal Management System
Copyright notice
(C) 2003-2019 Francesco Iannuzzelli <[email protected]>
All rights reserved
This script is part of PhPeace.
PhPeace is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
PhPeace is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The GNU General Public License (GPL) is available at
http://www.gnu.org/copyleft/gpl.html.
A copy can be found in the file COPYING distributed with
these scripts.
This copyright notice MUST APPEAR in all copies of the script!
********************************************************************/
if (!defined('SERVER_ROOT'))
define('SERVER_ROOT',$_SERVER['DOCUMENT_ROOT']);
include_once(SERVER_ROOT."/../classes/error.php");
include_once(SERVER_ROOT."/../classes/layout.php");
include_once(SERVER_ROOT."/../classes/formhelper.php");
$fh = new FormHelper(false,0,false);
$get = $fh->HttpGet();
$l = new Layout;
$id = (int)$get['id'];
include_once(SERVER_ROOT."/../modules/dodc.php");
$dodc = new DodContractors();
$id_topic = $dodc->id_topic;
$params = array();
$params['id_module'] = 25;
$params['module'] = "dodc";
$params['subtype'] = "contract";
echo $l->Output("common",$id,$id_topic,1,$params);
?>
......@@ -46,7 +46,7 @@ $id_topic = $dodc->id_topic;
$params = array();
$params['id_module'] = 25;
$params['module'] = "dodc";
$params['subtype'] = "contractors";
$params['subtype'] = $id>0? "contractor" : "contractors";
echo $l->Output("common",$id,$id_topic,$page,$params);
?>
<?php
/********************************************************************
PhPeace - Portal Management System
Copyright notice
(C) 2003-2019 Francesco Iannuzzelli <[email protected]>
All rights reserved
This script is part of PhPeace.
PhPeace is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
PhPeace is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The GNU General Public License (GPL) is available at
http://www.gnu.org/copyleft/gpl.html.
A copy can be found in the file COPYING distributed with
these scripts.
This copyright notice MUST APPEAR in all copies of the script!
********************************************************************/
if (!defined('SERVER_ROOT'))
define('SERVER_ROOT',$_SERVER['DOCUMENT_ROOT']);
include_once(SERVER_ROOT."/../classes/error.php");
include_once(SERVER_ROOT."/../classes/layout.php");
include_once(SERVER_ROOT."/../classes/formhelper.php");
$fh = new FormHelper(false,0,false);
$get = $fh->HttpGet();
$l = new Layout;
$id = (int)$get['id'];
$page = (int)$get['p'];
include_once(SERVER_ROOT."/../modules/dodc.php");
$dodc = new DodContractors();
$id_topic = $dodc->id_topic;
$params = array();
$params['id_module'] = 25;
$params['module'] = "dodc";
$params['subtype'] = $id>0? "office":"offices";
echo $l->Output("common",$id,$id_topic,$page,$params);
?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment