Forum

Custom screen
 
Notifications
Retirer tout

Custom screen

9 Posts
2 Utilisateurs
0 Reactions
4,739 Vu
(@durou-c)
Posts: 468
Contributor
Début du sujet
 
[#6239]

I just move to 8.1.6 version,
I need to do some custom field on opportunities,

and now I got error:
2019-09-10 19:02:07.160 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:07.160 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] Exception-[42S02] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'projeqtor_test.opportunitymain' doesn't exist
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] For query : select * from opportunitymain where id=83
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] Strack trace :
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] #0 Sql->query called at [/var/www/projeqtor/model/persistence/SqlElement.php:2931]
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] #1 SqlElement->getSqlElement called at [/var/www/projeqtor/model/persistence/SqlElement.php:669]
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] #2 SqlElement->__construct called at [/var/www/projeqtor/model/OpportunityMain.php:125]
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] #3 OpportunityMAin->__construct called at [/var/www/projeqtor/model/custom/Opportunity.php:192]
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] #4 Opportunity->setAttributes called at [/var/www/projeqtor/view/objectDetail.php:640]
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] #5 drawTableFromObject called at [/var/www/projeqtor/view/objectDetail.php:311]
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.504
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.504
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.504
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.504 ** ERROR ** [V8.1.6] Error on SqlElement to get 'id' for Class 'OpportunityMAin' : field 'id' not found in Database.
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.505
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.505
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.505
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] Error on SqlElement to get 'reference' for Class 'OpportunityMAin' : field 'reference' not found in Database.
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.505
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.505
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.505
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] Error on SqlElement to get 'name' for Class 'OpportunityMAin' : field 'name' not found in Database.
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.505
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.505
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.505
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] Error on SqlElement to get 'idOpportunityType' for Class 'OpportunityMAin' : field 'idOpportunityType' not found in Database.
2019-09-10 19:02:59.505 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.505
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.506
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.506
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] Error on SqlElement to get 'idProject' for Class 'OpportunityMAin' : field 'idProject' not found in Database.
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.506
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.506
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.506
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] Error on SqlElement to get 'creationDate' for Class 'OpportunityMAin' : field 'creationDate' not found in Database.
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.506
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.506
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.506
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] Error on SqlElement to get 'idUser' for Class 'OpportunityMAin' : field 'idUser' not found in Database.
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.506
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.506
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.506
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.506 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] Error on SqlElement to get 'idSeverity' for Class 'OpportunityMAin' : field 'idSeverity' not found in Database.
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.507
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.507
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.507
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] Error on SqlElement to get 'idLikelihood' for Class 'OpportunityMAin' : field 'idLikelihood' not found in Database.
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.507
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.507
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.507
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] Error on SqlElement to get 'idCriticality' for Class 'OpportunityMAin' : field 'idCriticality' not found in Database.
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.507
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.507
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.507
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] Error on SqlElement to get 'impactCost' for Class 'OpportunityMAin' : field 'impactCost' not found in Database.
2019-09-10 19:02:59.507 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.507
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.507
** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.508
** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.508 ** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2991)
2019-09-10 19:02:59.508 ** ERROR ** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given
2019-09-10 19:02:59.508 ** ERROR ** [V8.1.6] Error on SqlElement to get 'projectReserveAmount' for Class 'OpportunityMAin' : field 'projectReserveAmount' not found in Database.
2019-09-10 19:02:59.508 ** ERROR ** [V8.1.6] ERROR **
2019-09-10 19:02:59.508
** ERROR ** [V8.1.6] on file '/var/www/projeqtor/model/persistence/SqlElement.php' at line (2989)
2019-09-10 19:02:59.508
** ERROR ***** [V8.1.6] cause = array_key_exists() expects parameter 2 to be array, boolean given


 
Posté : 10/09/2019 9:06 pm
(@durou-c)
Posts: 468
Contributor
Début du sujet
 

the table name of opportunities is change... look:

2019-09-11 08:58:16.810 ** ERROR ** [V8.1.6] Exception-[42S02] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'projeqtor_test.opportunitymain' doesn't exist


 
Posté : 11/09/2019 11:10 am
(@babynus)
Posts: 14952
Membre Admin
 

No, we did not change anythiong on opportunities.
I tried and add custom filed withoput issue.

Try and remove customization on opportuinity.
Then do it again.
It issue persists, please post here file /model/custom/Opportunity.php


 
Posté : 11/09/2019 11:19 am
(@durou-c)
Posts: 468
Contributor
Début du sujet
 

<?php
/ COPYRIGHT NOTICE ******************************************************
*
* Copyright 2009-2017 ProjeQtOr - Pascal BERNARD - support@projeqtor.org
* Contributors : -
*
* This file is part of ProjeQtOr.
*
* ProjeQtOr is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* ProjeQtOr 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 Affero General Public License for
* more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* ProjeQtOr. If not, see .
*
* You can get complete code of ProjeQtOr, other resource, help and information
* about contributors at http://www.projeqtor.org
*
DO NOT REMOVE THIS NOTICE *********************************************/

/** ============================================================================
* Opportunity.
*/
require_once('_securityCheck.php');
class Opportunity extends OpportunityMain {

public $_sec_description;
public $id;
public $reference;
public $produit;
public $name;
public $idOpportunityType;
public $idProject;
public $creationDate;
public $idUser;
public $idSeverity;
public $idLikelihood;
public $idCriticality;
public $impactCost;
public $projectReserveAmount;
public $Origin;
public $cause;
public $impact;
public $description;
public $_sec_treatment;
public $idStatus;
public $idResource;
public $idPriority;
public $initialEndDate;
public $actualEndDate;
public $handled;
public $handledDate;
public $done;
public $doneDate;
public $idle;
public $idleDate;
public $cancelled;
public $_lib_cancelled;
public $result;
public $_sec_Link;
public $_nbColMax=3;

public static $_customFields=array(
'produit'
);

private static $_fieldsAttributes=array(
"id"=>"nobr",
"reference"=>"readonly",
"name"=>"required",
"idProject"=>"required",
"idStatus"=>"required",
"idOpportunityType"=>"required",
"creationDate"=>"required",
"handled"=>"nobr",
"done"=>"nobr",
"idle"=>"nobr",
"idleDate"=>"nobr",
"cancelled"=>"nobr",
"projectReserveAmount"=>"readonly",
"produit"=>""
);

private static $_staticDisplayStyling=array(
);

private static $_colCaptionTransposition=array(
"produit"=>"plgProduit"
);

public static $_defaultValues=array(
);

/** ==========================================================================
* Constructor
* @param $id the id of the object in the database (null if not stored yet)
* @return void
*/
function __construct($id = NULL, $withoutDependentObjects=false) {
parent::__construct($id,$withoutDependentObjects);
}

/** ==========================================================================
* Destructor
* @return void
*/
function __destruct() {
parent::__destruct();
}

/** ==========================================================================
* Return the specific fieldsAttributes
* @return the fieldsAttributes
*/
protected function getStaticFieldsAttributes() {
return array_merge(parent::getStaticFieldsAttributes(),self::$_fieldsAttributes);
}

/** ==========================================================================
* Return the specific styling for fields
* @return the fields styling
*/
public function getStaticDisplayStyling() {
return self::$_staticDisplayStyling;
}

/** ============================================================================
* Set attribut from parent : merge current attributes with those of Main class
* @return void
*/
public function setAttributes() {
$parentClass=get_class($this)."Main";
if (!SqlElement::class_exists($parentClass)) return;
$parent=new $parentClass($this->id);
if (! method_exists($parent, "setAttributes")) return;
$parent->setAttributes();
if (method_exists("SqlElement","mergeAttributesArrays")) {
self::$_fieldsAttributes=SqlElement::mergeAttributesArrays(self::$_fieldsAttributes,$parent->getStaticFieldsAttributes());
} else {
self::$_fieldsAttributes=array_merge_preserve_keys(self::$_fieldsAttributes,$parent->getStaticFieldsAttributes());
}
} /** ============================================================================
* Return the specific colCaptionTransposition
* @return the colCaptionTransposition
*/
protected function getStaticColCaptionTransposition($fld=null) {
if (isset(self::$_colCaptionTransposition)) {
return array_merge(parent::getStaticColCaptionTransposition($fld),self::$_colCaptionTransposition);
} else {
return parent::getStaticColCaptionTransposition($fld);
}
}

/** ==========================================================================
* Return the generic defaultValues
* @return the layout
*/
protected function getStaticDefaultValues() {
return self::$_defaultValues;
}
}
?>


 
Posté : 11/09/2019 11:33 am
(@babynus)
Posts: 14952
Membre Admin
 

Please attaxch file (copy is hard to compare with expected)


 
Posté : 11/09/2019 12:01 pm
(@durou-c)
Posts: 468
Contributor
Début du sujet
 

I cannot send *.php files on this forum


 
Posté : 11/09/2019 12:03 pm
(@babynus)
Posts: 14952
Membre Admin
 

Just zip it and post the zip


 
Posté : 11/09/2019 12:10 pm
(@durou-c)
Posts: 468
Contributor
Début du sujet
 

find the zip files


 
Posté : 11/09/2019 12:32 pm
(@babynus)
Posts: 14952
Membre Admin
 

Fixed file attached.
It seems customization was not initialized with latest version of plugin.

Fix is to find function

public function setAttributes() {

and there replace

$parent=new $parentClass($this->id);

with

$parent=new $parentClass($this->id,true);

 
Posté : 11/09/2019 4:50 pm
Share:
Retour en haut