Highlighting Specific Records

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
User avatar
ronwill
Veteran Member
Posts: 101
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Highlighting Specific Records

Post by ronwill » 2018-10-29 15:45

Hi All,

I've been using this code from the AppGini Tutorials in my hooks for an invoice:

// modify the status field of the table view query to display 'Due' invoices in bold red
// $oldArray=$options->QueryFieldsTV;
// $options->QueryFieldsTV='';
// foreach($oldArray as $field => $caption){
// if($field=='`commercial`.`status`'){
// $options->QueryFieldsTV['IF(`commercial`.`status`=\'Due\', \'<b style="color: red; background: white">Due</b>\', IF(`commercial`.`status`=\'Paid\', \'<b style="color: green; background: white">Paid</b>\', `commercial`.`status`))']=$caption;
// }
// else{
// $options->QueryFieldsTV[$field]=$caption;
// }
// }

It's been working fine without any issues until I upgraded from PHP5.6 to PHP7.2 as recommended by my service provider. After upgrade I get a stream of error messages:

Warning: Illegal string offset '`commercial`.`id`' in /homepages/5/d106639433/htdocs/web4u0/hooks/commercial.php on line 37
Warning: Illegal string offset 'IF( CHAR_LENGTH(`webdata1`.`user`), CONCAT_WS('', `webdata1`.`user`), '') /* clientusername */' in /homepages/5/d106639433/htdocs/web4u0/hooks/commercial.php on line 37
Warning: Illegal string offset 'IF( CHAR_LENGTH(`webdata1`.`title`) || CHAR_LENGTH(`webdata1`.`company`), CONCAT_WS('', `webdata1`.`title`, ' - ', `webdata1`.`company`), '') /* Client */' in /homepages/5/d106639433/htdocs/web4u0/hooks/commercial.php on line 37


I've stepped back to PHP7.1 same errors, then PHP7.0 and working again


Just thought I'd point this out in case anyone else uses same code from shown above in any of their projects.

Does anyone have a fix for this?

PHP7.0 has PHP community support until 12/2018 - so bit of time yet!!


Cheers, Ron
Ron - AppGini Pro V 5.76 Rev 1058
Gloucestershire, UK

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 518
Joined: 2018-04-01 10:12

Re: Highlighting Specific Records

Post by pböttcher » 2018-10-29 16:11

Hi,

can you try to initialize your arrary and see.

Change
$options->QueryFieldsTV='';
to
$options->QueryFieldsTV=[];

User avatar
ronwill
Veteran Member
Posts: 101
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Re: Highlighting Specific Records

Post by ronwill » 2018-10-29 16:36

Hi PBöttcher,

Tried your suggestion with both PHP7.1 & PHP7.2 - WORKING ON BOTH

Thank you very much for instant response, suggest the tutorial example is updated to show the same (who does that?)

Thanks again,
Ron :D
Ron - AppGini Pro V 5.76 Rev 1058
Gloucestershire, UK

Post Reply