384 lines
13 KiB
PHP
384 lines
13 KiB
PHP
<?php
|
|
class Projets extends CI_Controller {
|
|
|
|
function __construct()
|
|
{
|
|
parent::__construct('projets');
|
|
$this->load->helper('url');
|
|
$this->load->library('pagination');
|
|
$this->load->model('Projets_model');
|
|
$this->load->model('Tache_model');
|
|
$this->load->model('Config_model');
|
|
$this->load->library('table');
|
|
$this->load->helper('form');
|
|
$this->load->library('session');
|
|
$this->lang->load("text_".config_item('pw_client'),"french");
|
|
$this->load->helper('jira_helper');
|
|
|
|
}
|
|
public function index()
|
|
{
|
|
|
|
|
|
$this->load->view('projets/header' );
|
|
$this->load->view('projets/list' );
|
|
$this->load->view('projets/footer' );
|
|
}
|
|
public function depart()
|
|
{
|
|
|
|
|
|
$this->load->view('projets/header' );
|
|
$this->load->view('projets/listdepart' );
|
|
$this->load->view('projets/footer' );
|
|
}
|
|
public function list_taches()
|
|
{
|
|
|
|
|
|
$this->load->view('tache/header' );
|
|
$this->load->view('tache/list' );
|
|
$this->load->view('tache/footer' );
|
|
}
|
|
public function loadData_list($record=0,$filtre1='',$filtre2='',$filtre3='',$filtre4='',$trie='null',$listactive=1,$excel=0,$filtre5='',$date_debut,$date_fin,$filtre6='') {
|
|
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_projet','mem_select_1',$filtre1,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_projet','mem_select_2',$filtre2,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_projet','mem_select_3',$filtre3,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_projet','mem_select_4',$filtre4,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_projet','mem_select_5',$filtre5,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_projet','mem_select_6',$filtre6,1,0);
|
|
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_projet','mem_listactive',$listactive,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_projet','mem_trie',$trie,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_projet','date_debut',$date_debut,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_projet','date_fin',$date_fin,1,0);
|
|
|
|
|
|
$filtre1=urldecode($filtre1);
|
|
$filtre2=urldecode($filtre2);
|
|
$filtre3=urldecode($filtre3);
|
|
$filtre4=urldecode($filtre4);
|
|
$filtre5=urldecode($filtre5);
|
|
$filtre6=urldecode($filtre6);
|
|
|
|
$trie=urldecode($trie);
|
|
$data=$this->Projets_model->mod_loadData_list($record,$filtre1,$filtre2,$filtre3,$filtre4,$trie,$listactive,$excel,$filtre5,$date_debut,$date_fin,$filtre6);
|
|
|
|
echo json_encode($data);
|
|
}
|
|
public function loadData_list_depart($record=0,$filtre1='',$filtre2='',$filtre3='',$filtre4='',$trie='null',$listactive=1,$date_debut="2019-01-01",$date_fin="2025-01-01",$excel=0) {
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_depart','mem_select_1',$filtre1,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_depart','mem_select_2',$filtre2,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_depart','mem_select_3',$filtre3,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_depart','mem_select_4',$filtre4,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_depart','date_debut',$date_debut,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_depart','date_fin',$date_fin,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_depart','mem_listactive',$listactive,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_depart','mem_trie',$trie,1,0);
|
|
|
|
|
|
|
|
|
|
$filtre1=urldecode($filtre1);
|
|
$filtre2=urldecode($filtre2);
|
|
$filtre3=urldecode($filtre3);
|
|
$filtre4=urldecode($filtre4);
|
|
$trie=urldecode($trie);
|
|
$data=$this->Projets_model->mod_loadData_list_depart($record,$filtre1,$filtre2,$filtre3,$filtre4,$trie,$listactive,$date_debut,$date_fin,$excel);
|
|
|
|
|
|
|
|
echo json_encode($data);
|
|
}
|
|
|
|
public function loadData_list_taches($record=0,$filtre1='',$filtre2='',$filtre3='',$filtre4='',$trie='null',$listactive=1,$excel=0) {
|
|
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_tache','mem_select_1',$filtre1,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_tache','mem_select_2',$filtre2,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_tache','mem_select_3',$filtre3,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_tache','mem_select_4',$filtre4,1,0);
|
|
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_tache','mem_listactive',$listactive,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_tache','mem_trie',$trie,1,0);
|
|
|
|
|
|
|
|
|
|
$filtre1=urldecode($filtre1);
|
|
$filtre2=urldecode($filtre2);
|
|
$filtre3=urldecode($filtre3);
|
|
$filtre4=urldecode($filtre4);
|
|
$trie=urldecode($trie);
|
|
$data=$this->Projets_model->mod_loadData_list_taches($record,$filtre1,$filtre2,$filtre3,$filtre4,$trie,$listactive,$excel);
|
|
|
|
echo json_encode($data);
|
|
}
|
|
|
|
public function form($mem_id,$error='',$new='',$detail_id=0)
|
|
{
|
|
|
|
// $error['error']=array('type'=>'error','message'=>'test');
|
|
|
|
|
|
|
|
$confimpdf=$this->Projets_model->prepare_list_confirmation($mem_id);
|
|
$factpdf=$this->Projets_model->prepare_list_facturation($mem_id);
|
|
|
|
|
|
|
|
|
|
// section bouton confirmation
|
|
|
|
$confirmation=$this->Projets_model->prepare_bouton_confirmation($mem_id,true);
|
|
$facturation=$this->Projets_model->prepare_bouton_facturation($mem_id,true);
|
|
|
|
// prépare tout les info pour la forme
|
|
$data=$this->Projets_model->mod_getforminfo($mem_id);
|
|
|
|
$info=$this->Projets_model->mod_getforminfo_details($mem_id);
|
|
|
|
// $data['contacts']=$this->Fournisseurs_model->mod_listcontact($mem_id);
|
|
if ($this->config->item('pw_client') === 'ms1') {
|
|
|
|
$data['list_pro_auto'] = $this->Projets_model->list_info_pro_auto(2);
|
|
}
|
|
|
|
$data['facturation']=$facturation;
|
|
$data['factpdf']=$factpdf;
|
|
|
|
$data['confirmation']=$confirmation;
|
|
$data['confimpdf']=$confimpdf;
|
|
$data['proj_ent_id']=$mem_id;
|
|
$data['details_id']=$detail_id;
|
|
$data['new']=$new;
|
|
$data['produits']=$info;
|
|
|
|
$this->load->view('projets/header' );
|
|
$this->load->view('projets/form',$data );
|
|
$this->load->view('projets/footer',$error );
|
|
|
|
}
|
|
public function form_tache($mem_id,$section,$section_id,$page,$section_type='',$details_id=0)
|
|
{
|
|
|
|
|
|
// prépare tout les info pour la forme
|
|
$data=$this->Tache_model->mod_getforminfo($mem_id,$section,$section_id);
|
|
$data['page']=$page;
|
|
$data['details_id']=$details_id;
|
|
|
|
// if (strtoupper($section)=='PROJETS')
|
|
$html=$output['html']=$this->load->view('tache/popupevent',$data,true );
|
|
// else
|
|
// $html=$output['html']=$this->load->view('tache/popupeventstatut',$data,true );
|
|
|
|
echo json_encode($html);
|
|
}
|
|
|
|
|
|
public function pro_auto($pro_auto_desc_id,$proj_id){
|
|
//echo($pro_auto_desc_id);
|
|
$this->Projets_model->cree_pro_auto($pro_auto_desc_id,$proj_id);
|
|
redirect('/projets/form/'.$proj_id);
|
|
|
|
}
|
|
public function test(){
|
|
print_r( $this->Config_model->conf_getListeevenement());
|
|
}
|
|
public function download(){
|
|
$this->load->helper('download');
|
|
echo(base_url().'/pdf/pdf2019/confirmation/Village_Vacances_Valcartier_Segment_Marketing_2020002-1562619071.pdf');
|
|
echo '<a href="'. base_url().'/pdf/pdf2019/confirmation/Village_Vacances_Valcartier_Segment_Marketing_2020002-1562619071.pdf ">Link</a>';
|
|
|
|
force_download(base_url().'/pdf/pdf2019/confirmation/Village_Vacances_Valcartier_Segment_Marketing_2020002-1562619071.pdf', NULL);
|
|
}
|
|
|
|
|
|
|
|
public function create_proj_details($proj_ent_id,$proj_prod_id,$proj_fou_id){
|
|
$data=$this->Projets_model->mod_create_proj_details($proj_ent_id,$proj_prod_id,$proj_fou_id);
|
|
// $data=$this->form($proj_ent_id);
|
|
echo json_encode($data);
|
|
}
|
|
public function save_proj_details($id,$projet_id){
|
|
|
|
$this->Projets_model->mod_save_proj_details($id,$_POST);
|
|
$error=array('type'=>'success','message'=>'Fiche sauvegardé');
|
|
redirect('/projets/form/'.$projet_id );
|
|
}
|
|
public function save_proj_details_client($id,$projet_id,$go=""){
|
|
|
|
|
|
$this->Projets_model->mod_createRecordbd($_POST, "proj_", 0,$projet_id);
|
|
$error=array('type'=>'success','message'=>'Fiche sauvegardé');
|
|
|
|
if ($go==""){
|
|
redirect('/clients/form/'.$id );
|
|
}else{
|
|
redirect('/'.$go );
|
|
}
|
|
|
|
|
|
}
|
|
public function deleteproduits($id,$projet_id){
|
|
$this->Projets_model->mod_deleteproduits($id);
|
|
$error=array('type'=>'success','message'=>'Fiche effacé');
|
|
redirect('/projets/form/'.$projet_id );
|
|
}
|
|
|
|
|
|
|
|
|
|
public function saveRecord($id,$client_id=0 )
|
|
{
|
|
|
|
|
|
$id=$this->Projets_model->mod_createRecordbd($_POST,'proj_',$client_id,$id);
|
|
|
|
if ($id!=0)
|
|
$error=array('type'=>'success','message'=>'Fiche sauvegardé');
|
|
else
|
|
$error=array('type'=>'error','message'=>'test');
|
|
|
|
// creer doc dans google
|
|
if ($this->config->item('pw_client') === 'ms1') {
|
|
$this->load->model('GoogleDocs_model');
|
|
|
|
|
|
//MSTIM-756
|
|
if($_POST['proj_type']==668){
|
|
$this->GoogleDocs_model->creer_document($id);
|
|
}
|
|
|
|
|
|
}
|
|
if ($client_id==0){
|
|
$this->form($id,$error);
|
|
}else{
|
|
//redirect('/Clients/form/'.$client_id.'/'.$error);
|
|
redirect('/Clients/form/'.$client_id);
|
|
}
|
|
}
|
|
|
|
public function creetache($id,$section,$section_id,$page ,$details_id=0)
|
|
{
|
|
//Array ( [tach_aqui_id] => 0 [tach_echeance_date] => [tach_type] => 0 [tach_statut] => 0 [tach_note_demande] => [tach_note_suivie] => [buttonfin] => Ajout )
|
|
//https://ms1crmdev.progiweb.net/index.php/projets/creetache/0/projetsclient/606/form/1292
|
|
|
|
print_r($_POST);exit;
|
|
|
|
$id=$this->Tache_model->mod_createRecordbd($_POST,$section,$section_id,$details_id);
|
|
|
|
|
|
|
|
}
|
|
// sl test
|
|
public function savetache($id,$section,$section_id,$page ,$details_id=0)
|
|
{
|
|
|
|
|
|
if ($id!=0){
|
|
$id=$this->Tache_model->mod_saveRecordbd($_POST,$id);
|
|
|
|
}
|
|
else{
|
|
|
|
$id=$this->Tache_model->mod_createRecordbd($_POST,$section,$section_id,$details_id);
|
|
|
|
|
|
}
|
|
|
|
if ($page=='listprojets')
|
|
redirect('TachesProjets');
|
|
//$section='projets';
|
|
|
|
if($section=='projetsclient' || $section=='projetsfournisseur')
|
|
$section='projets';
|
|
|
|
|
|
|
|
if ($page=='form')
|
|
redirect('/'.$section.'/form/'.intval($section_id).'/ / /'.$details_id);
|
|
else
|
|
redirect('Projets/list_taches');
|
|
|
|
}
|
|
|
|
|
|
public function createRecord($id,$client_id=0 )
|
|
{
|
|
|
|
|
|
$id=$this->Projets_model->mod_createRecordbd($_POST,'proj_',$client_id,$id);
|
|
|
|
if ($id!=0)
|
|
$error=array('type'=>'success','message'=>'Fiche sauvegardé');
|
|
else
|
|
$error=array('type'=>'error','message'=>'test');
|
|
|
|
$this->form($id,$error);
|
|
|
|
}
|
|
public function choix_produit($id){
|
|
$data=$this->Projets_model->mod_choix_produit($id);
|
|
|
|
// if ($this->config->item('pw_client') === 'ms1') {
|
|
// $data["gen_actif_fournisseur"]=0;
|
|
// }
|
|
|
|
echo json_encode($data);
|
|
}
|
|
|
|
public function desactivate_confirmation($numero_lot,$id){
|
|
$this->load->model('Lots_model');
|
|
|
|
$data=$this->Projets_model->mod_desactivate_confirmation($numero_lot);
|
|
redirect('/projets/form/'.$id);
|
|
}
|
|
public function desactivate_facturation($numero_lot,$id){
|
|
$this->load->model('Lots_model');
|
|
|
|
$data=$this->Projets_model->mod_desactivate_facturation($numero_lot);
|
|
redirect('/projets/form/'.$id);
|
|
}
|
|
public function lock_facturation($numero_lot,$id){
|
|
$this->load->model('Lots_model');
|
|
|
|
$data=$this->Projets_model->mod_lock_facturation($numero_lot);
|
|
redirect('/projets/form/'.$id);
|
|
}
|
|
|
|
public function prepare_confirmation($id){
|
|
$this->load->model('Lots_model');
|
|
|
|
$data=$this->Projets_model->mod_prepare_confirmation($id);
|
|
redirect('/projets/form/'.$id);
|
|
}
|
|
public function prepare_facturation($id){
|
|
$this->load->model('Lots_model');
|
|
|
|
$data=$this->Projets_model->mod_prepare_facturation($id);
|
|
redirect('/projets/form/'.$id);
|
|
}
|
|
|
|
public function listtache_btn($section,$section_id){
|
|
|
|
$retour=$this->Tache_model->mod_listtache_btn($section,$section_id);
|
|
echo($retour);
|
|
|
|
|
|
|
|
}
|
|
public function test2($id){
|
|
|
|
$info=$this->Config_model->fx_info_google_calendar($id);
|
|
|
|
echo '<pre>', print_r($info, true), '</pre>';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} |