Change of field type possible?

iluvsuna
iluvsuna
Offline
0
Hi,

I would to know if I can modify the invoice item description to textarea? I need to put in a length description there. Please advis.

Thank you.
Responses (7)
  • Accepted Answer

    Wednesday, September 11 2013, 07:44 AM - #Permalink
    0
    for this, you need to go down to the DB table invoices_items and change the field type from VARCHAR to TEXT
    The reply is currently minimized Show
  • Accepted Answer

    iluvsuna
    iluvsuna
    Offline
    Wednesday, September 11 2013, 07:58 AM - #Permalink
    0
    yes i did that. but how can i change it to textarea in the invoice page?
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, September 12 2013, 09:14 AM - #Permalink
    0
    oh, in that case you need to go to the /administrator/components/com_invoices/views/invoice/tmpl/form.php file and change it there...
    but also in the javascript file /assets/items.js

    be careful because it can be tricky...
    The reply is currently minimized Show
  • Accepted Answer

    iluvsuna
    iluvsuna
    Offline
    Thursday, September 12 2013, 09:43 AM - #Permalink
    0
    hi germi, thanks so much for your reply. it worked ok after modifying form.php. but i can't find what is change in items.js as i notice the function is new_song()?

    another question - when the product desc and notes are shown on the invoice template, the line breaks are all gone, resulting in 1 line. how can i change that?
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, September 12 2013, 04:36 PM - #Permalink
    0
    yes, that's the function.

    after this:

    newCell = newRow.insertCell(5);

    some new content is added, you need to replace the input for a textarea.

    2) that's because no HTML is allowed in here.
    what you would need to do in this case is open /administrator/components/com_invoices/models/invoice.php and find the store() function

    after this:

    if(!$data) $data = JRequest::get( 'post' );


    you need to add this:

    $data['notes'] = JRequest::getVar('notes', '', 'post', 'string', JREQUEST_ALLOWRAW);


    to allow HTML in that field.
    The reply is currently minimized Show
  • Accepted Answer

    iluvsuna
    iluvsuna
    Offline
    Friday, September 13 2013, 08:05 AM - #Permalink
    0
    hi germi, thank you so much for your help. everything worked out except allowing html in the desc field.

    i put in $data['desc'] = JRequest::getVar('desc', '', 'post', 'string', JREQUEST_ALLOWRAW); as well but there is no response. is there a different place to put it?
    The reply is currently minimized Show
  • Accepted Answer

    Friday, September 13 2013, 03:22 PM - #Permalink
    0
    it's not $data['desc'] because there are many items. the items are handled below in the same function

    look for this code...:
    [code ]"desc" => $data["0_description_" . $item_id],[/code]
    The reply is currently minimized Show
Your Reply