⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Add row from another table



SamArt

SamArt
  • profile picture
  • Member

Posted 03 December 2019 - 12:31 PM

Hi,

I would like to create default payment record by selecting an invoice: selecting a row in the invoice list with an action button would filled the add payment page with information from the selected invoice.

I'm using GroceryCrud 1.6.3 with Bootstrap 3.

 

In the controller, as shown below, I added an add_action line (*) that lead the user to the cash management add page with the id of the invoice he has selected in the url

ex: "/plans/cash_management/add/559"

The thing is I cannot manage to populate fields of the payment to be added by elements from the invoice with id ''559''. Fields are just empty.

_________________________________________________

public function billing_management()
    {
            $crud = new grocery_CRUD();
            $crud->set_model('MY_grocery_Model');
            $crud->set_language("french");
            $crud->set_table('facture');
            $crud->columns('Societe', 'Fiscale', 'Code_chantier', 'Lieu', 'Code_facture', 'Composant', 'Date_facture', 'Date_echeance', 'Date_revue', 'Montant_HT', 'Montant_TTC', 'Lettrage','Note');
            $crud->set_subject('Facture');
            $crud->field_type('Societe', 'hidden', 'ART');
            $crud->callback_column(('Montant_HT'),array($this,'format_num'));
            $crud->callback_column(('Montant_TTC'),array($this,'format_num'));
           
        *   //$crud->add_action('Encaissement', '' , 'plans/cash_management/add', 'fa-euro');

 

            $output = $crud->render();
            $this->_plan_output($output);
    }
 

Thx for your help.