Exemplo n.º 1
0
 function save_lines(array $post, AOR_Report $bean, $postKey)
 {
     $seenIds = array();
     if (isset($post[$postKey . 'id'])) {
         foreach ($post[$postKey . 'id'] as $key => $id) {
             if ($id) {
                 $aorChart = BeanFactory::getBean('AOR_Charts', $id);
             } else {
                 $aorChart = BeanFactory::newBean('AOR_Charts');
             }
             $aorChart->name = $post[$postKey . 'title'][$key];
             $aorChart->type = $post[$postKey . 'type'][$key];
             $aorChart->x_field = $post[$postKey . 'x_field'][$key];
             $aorChart->y_field = $post[$postKey . 'y_field'][$key];
             $aorChart->aor_report_id = $bean->id;
             $aorChart->save();
             $seenIds[] = $aorChart->id;
         }
     }
     //Any beans that exist but aren't in $seenIds must have been removed.
     foreach ($bean->get_linked_beans('aor_charts', 'AOR_Charts') as $chart) {
         if (!in_array($chart->id, $seenIds)) {
             $chart->mark_deleted($chart->id);
         }
     }
 }
Exemplo n.º 2
0
 public function testbuild_report_query_where()
 {
     $aor_Report = new AOR_Report();
     $aor_Report->report_module = 'Accounts';
     //execute the method and verify that it retunrs expected results
     $expected = array('where' => array('accounts.deleted = 0 '));
     $actual = $aor_Report->build_report_query_where();
     $this->assertSame($expected, $actual);
 }