Re: cannot save data into database

2008-12-23 Thread ridwan arifandi

is there anyone can help me out?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



cannot save data into database

2008-12-19 Thread ridwan arifandi

hi all

i have an application based on cakephp

in the controller, i'm using more than one model.

the code :

data) && 
!empty($this->data['TransactionInvoice']
['action'])) :

$userrole   = $this->Session->Read('userrole');
$action = 
$this->data['TransactionInvoice']['action'];

$conditions = array(

'TransactionInvoice.action' => "'".$action."'",

'TransactionInvoice.action_date'=> "'".date('Y-m-d')."'",
   );

if($userrole == 'buyer') :

$conditions['TransactionInvoice.buyer_id'] = 
$this->Session->Read
('buyer_id');

elseif($userrole == 'distro') :

$conditions['Product.distro_id'] = 
$this->Session->Read
('distro_id');

endif;

$this->TransactionInvoice->UpdateAll($conditions,array
("TransactionInvoice.id IN (".$this->data['TransactionInvoice']
['id'].")"));

//create new transaction transfer data

if($action == 'accept') :

$data = array();

$this->TransactionTransfer->Create($data);

$data['TransactionTransfer'] = array(
'buyer_id'  => 
$this->Session->Read('buyer_id'),
'distro_id' => 
$this->data['TransactionInvoice']['distro_id'],
'product_id'=> 
$this->data['TransactionInvoice']['product_id'],
'transaction_request_id'=> 
$this->data['TransactionInvoice']
['transaction_request_id'],
'action'=> 'wait',
);

$this->TransactionTransfer->Save($data);

endif;

endif;

}

}

the problem is $this->TransactionTransfer->Save($data);
i'm using develope mode no 2, and there isn't any query data in log
i dont know, but in other controllers, there is nothing error

would you like to help me?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax form FIELDS validation :-) How to?

2008-12-10 Thread ridwan arifandi

why dont use jquery?

actually, i dislike ajax system from cakephp. just like ajax form,
ajax field etc, i prefer use jquery system.

try to look http://jquery.bassistance.de/validate/demo/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Setting validation error in a controller?

2008-12-08 Thread ridwan arifandi

you can use $this->ModalName->invalidate(field_name, message),
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: jQuery helper....

2008-12-08 Thread ridwan arifandi

i'm developing an ajax website and don't use jquery helper, but it
still can work

On Dec 8, 10:42 pm, Marcus Silva <[EMAIL PROTECTED]> wrote:
> Hey Gonzalo,
>
> Thanks for the help.
>
> On Dec 8, 1:10 pm, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote:
>
> > On Mon, Dec 8, 2008 at 10:47 AM, Marcus Silva <[EMAIL PROTECTED]>wrote:
>
> > > Does anyone know if anyone has written a jQuery helper?
>
> > > Really need one to add similar features found here:
> > >http://ui.jquery.com/demos
> > > to a site.
>
> > > Any hints/help will be greatly appreciated.
>
> > > Many thanks in advance.
>
> > As per the talk Felix gave at the CakeFest which just finished last week, I
> > believe he mentioned that a helper is on its way to do basic tasks, but to
> > do more complicated things with jQuery you need to write the JS.
>
> > - Gonzalo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $ajax->form code generation issues in ajax layouts

2008-12-08 Thread ridwan arifandi

no, i dont use jquery helpers. just embed jquery into default layout,
and write some ajax code

ridwan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: saving into multiple table with multiple data

2008-12-08 Thread ridwan arifandi

thanks for your reply..

i tried it too, and it cannot work,

i used debug($data_item) in temporary_items_controller.php and debug
($data) in model.php, it wasn't empty ( has value )

i dont know, only ITEM model but others can work rightly

thanks a lot


On Dec 8, 6:00 pm, Milmar <[EMAIL PROTECTED]> wrote:
> Try to log what $data_item contains and check if the structure being
> passed to the model is correct.
>
> Then you can try
> $this->Item->Create($data_item); and;
> $this->Item->Save($data_item);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $ajax->form code generation issues in ajax layouts

2008-12-08 Thread ridwan arifandi

why dont use jquery?

i dont really enjoy cakephp ajax embed. now i'm developing an ajax web
application, first i used cakephp ajax tag and i dont like it. so i'm
using jquery and i'm very satisfy with it

On Dec 8, 12:35 pm, najnarp <[EMAIL PROTECTED]> wrote:
> I don't see the right code being generated when using ajax layouts.
> The Event.Observe code is not getting generated. With default layouts
> I can see the right code coming out.
>
> E.g. I see the  but the javascript after that for
> Event.Observe is missing
>
> I put some debug in the Javascript helper code and I see that in func
> codeBlock - the tags['javascriptblock'] settings empty so the sprintf
> returns an empty string.
>
>  if ($options['inline']) {
>                                 if ($block) {
>                                         return sprintf($this->tags
> ['javascriptblock'], $script);
>                                 } else {
>                                         return sprintf($this->tags
> ['javascriptstart']).ife($safe, "\n" . '//

Re: saving into multiple table with multiple data

2008-12-08 Thread ridwan arifandi

here is the code..

now, this function can work normally, but only for ITEM model, i use
manual query likle "INSERT INTO 'items' VALUES(...)".
$this->Item->getLastInsertID doesn't work too, so i use
msqyl_insert_id ant it works.



function finish()
{
$user_id= $this->Session->Read('user_id');
$date   = date('Y-m-d');

$purchase   = 
$this->TemporaryPurchase->findByUserId($user_id);

//--
Purchase-//

//setting data before save
$data_purchase  = $purchase['TemporaryPurchase'];
$data_purchase['entry_by']  = $user_id;
$data_purchase['entry_date']= $date;
$data_purchase['f_valid']   = 'f';
unset($data_purchase['id']);

//saving data into table
$this->Purchase->Create($data_purchase);
$this->Purchase->Save($data_purchase);

$purchase_id= $this->Purchase->getLastInsertID();

$i = 0;

foreach($purchase['TemporaryPurchaseDetail'] as 
$purchase_detail) :

$item   = 
$this->TemporaryItem->findById($purchase_detail
['temporary_item_id']);
$purchase_item_details  = 
$this->TemporaryPurchaseItemDetail-
>findAllByTemporaryPurchaseDetailId($purchase_detail['id']);

//--
Item-//

//setting data before save
$data_item = $item['TemporaryItem'];
$data_item['entry_by']  = $user_id;
$data_item['entry_date']= $date;
$data_item['f_expired'] = 'f';
$data_item['f_return']  = 'f';
$data_item['f_active']  = 'f';

unset($data_item['id']);
unset($data_item['user_id']);

$this->data['Item'] = $data_item;

/*--- the problem goes 
here
*/
$this->Item->Create($this->data);
$this->Item->Save($this->data);

$item_id= $this->Item->getLastInsertID();
/
*
*/


if(!empty($item_id)) :

//setting id for next save


//--
PurchaseDetail  -//

//setting data before save
$data_purchase_detail   = array(
'purchase_id'   => $purchase_id,
'item_id'   => $item_id,
'quantity'  => 
$purchase_detail['quantity'],
);

//saving data into table

$this->PurchaseDetail->Create($data_purchase_detail);

$this->PurchaseDetail->Save($data_purchase_detail);
$purchase_detail_id = 
$this->PurchaseDetail->getLastInsertID();


$purchase['TemporaryPurchaseDetail'][$i]['TemporaryItem']   = $item
['TemporaryItem'];
$purchase['TemporaryPurchaseDetail'][$i]
['TemporaryPurchaseItemDetail'] = $purchase_item_details;

$j  = 0;
foreach($purchase_item_details as 
$purchase_item_detail) :

$item_detail= 
$this->TemporaryItemDetail->findById
($purchase_item_detail['TemporaryPurchaseItemDetail']
['temporary_item_detail_id']);
$purchase['TemporaryPurchaseDetail'][$i]
['TemporaryPurchaseItemDetail'][$j]['TemporaryItemDetail'] =
$item_detail['TemporaryItemDetail'];


//--
ItemDetail  -//

//setting data before save
$data_item_detail   = 
$item_detail['TemporaryItemDetail'];
$data_item_detail['item_id']= 
$item_id;

saving into multiple table with multiple data

2008-12-07 Thread ridwan arifandi

i have 5 tables like these

1). purchases

2). purchase_details
 - purchase_id
 - item_id
3). items

4). purchase_item_details
 - purchase_detail_id
 - item_detail_id
5). item_details
 - item_id

in an action, i have to do more than one save action. rule

1). save data into purchases
2). get last insert id from table purchases

3). save data into items
4). get last insert id from table items

5). save data into purchase_details with those two variables
( purchase_id & item_id )
6). get last insert id from table purchase_details

7). save data into item_details with item_id
8). get last insert id from table item_details

9). save data into purchase_item_detail with those two variables
( purchase_detail_id & item_detail_id )

so.. i get a problem at rule #3... it cannot save, dont know why, i
have no error message at my web

items table


CREATE TABLE IF NOT EXISTS `items` (
  `id` int(11) NOT NULL auto_increment,
  `item_type_id` int(11) NOT NULL,
  `item_brand_type_id` int(11) NOT NULL,
  `desc` text NOT NULL,
  `info` text NOT NULL,
  `default_price` int(11) NOT NULL,
  `entry_date` date NOT NULL,
  `entry_by` int(11) NOT NULL,
  `update_date` date NOT NULL,
  `update_by` int(11) NOT NULL,
  `f_expired` enum('t','f') NOT NULL,
  `f_return` enum('t','f') NOT NULL,
  `f_active` enum('t','f') NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

please help me...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Phpcake

2008-12-04 Thread ridwan arifandi

hmmm...

i think i had the problem same as with you.

i tried by uploading new cakephp engine (zip version) into server,
then in cpanel i extracted the file. dont forget to delete old cakephp
engine before you upload a new one.

sorry for not smart advice :p
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Behavior can create new records but fails to update.

2008-12-04 Thread ridwan arifandi

try

$model->id = $foo['User']['id']
$data = $model->Read();

$data['User']['...'] = ;

then save
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



cakephp with jquery not with prototype

2008-12-03 Thread ridwan arifandi

i'm a newbie in cakephp programming.

cakephp uses prototype as ajax framework, but i dislike prototype just
love jquery.

i found lot of posts that discusing about cakephp with jquery, but
none of them can satisfy me and all of them cannot work when i use
them.

before using cakephp, i have better knowledge in wordpress and i can
use jquery within it. but with cakephp, i think it's too hard to embed
with jquery such as ajax validatiion etc.

would you like to help me give some working application with jquery.

anyway, thanks for your help

ps : sory for my poor english
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using model without a database for form

2008-12-01 Thread ridwan arifandi



On Oct 2, 10:49 am, sniper <[EMAIL PROTECTED]> wrote:
> i finally got it! i searched "cakephp _schema" and got this 
> linkhttp://snook.ca/archives/cakephp/contact_form_cakephp/
> when i implemented it, to my surprise it worked! So i striped my cheer
> model to exactly like contact one and that too worked.
> So turns out (after little debugging) i had to call parent class
> constructor since i was doing some init in my constructor.
> i added a line parent::__construct(); this fixed the problem
>

hi sniper

i've created a tableless model and have same trouble with you,
where should i put thec parent::_construct() in my constructor?

thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---