where is Save As Copy Function ??
where is Save As Copy Function ??
hello
already use tablename_after_update() to insert date to other tables
but i would like use Save As Copy Function to insert new record in table and also insert date to other tables
i dont know where i can find or create Save As Copy Function ??
thanks a lot
already use tablename_after_update() to insert date to other tables
but i would like use Save As Copy Function to insert new record in table and also insert date to other tables
i dont know where i can find or create Save As Copy Function ??
thanks a lot
Re: where is Save As Copy Function ??
Hi,
just use the tablename_after_insert function. You have all the data in the $data array to do what you need.
just use the tablename_after_insert function. You have all the data in the $data array to do what you need.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: where is Save As Copy Function ??
thanks for your replay ,
tablename_after_insert will insert data on other table once i press Save
tablename_after_insert will insert data on other table once i press Save
Re: where is Save As Copy Function ??
in tablename_after_insert you can use the data in the "data" array and e.g. call a sql statement to insert the data into another table. This will happen after you press the save button on your site.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: where is Save As Copy Function ??
thanks again
you are right
if i use tablename_after_insert ,,, if user add new row (( add new )) once he press Save .
Save As Copy ===> make copy off database row and add in same table with now ID ...
for Example
in my project ,
user make some change like Date and when press Save As Copy will have two row ,
one is old row and new one with new information .
extra I want run sql statement to insert the data into another table when press Save As Copy.
(( i already use run sql statement to insert the data into another table with tablename_after_Update) and its work fine
thanks a lot
you are right
if i use tablename_after_insert ,,, if user add new row (( add new )) once he press Save .
Save As Copy ===> make copy off database row and add in same table with now ID ...
for Example
in my project ,
user make some change like Date and when press Save As Copy will have two row ,
one is old row and new one with new information .
extra I want run sql statement to insert the data into another table when press Save As Copy.
(( i already use run sql statement to insert the data into another table with tablename_after_Update) and its work fine
thanks a lot
Re: where is Save As Copy Function ??
Hi,
maybe I still do not get what you want. If the users hits the safe as copy AppGini will treat this like if you would insert a new record.
So all the hooks before_insert and after_insert apply.
So if you want just to put the data into another table, but dont actually store that data in the same table, you can either use the before_insert hook, run your sqlstatement to insert the data into the other table and return false. If you return false, the record will not be entered into the actual table ( but you will get an alert).
Otherwise you can use the after_insert hook to run your sqlstatement and delete the actual record from your actual table. Like this you just increase your auto_increment.
maybe I still do not get what you want. If the users hits the safe as copy AppGini will treat this like if you would insert a new record.
So all the hooks before_insert and after_insert apply.
So if you want just to put the data into another table, but dont actually store that data in the same table, you can either use the before_insert hook, run your sqlstatement to insert the data into the other table and return false. If you return false, the record will not be entered into the actual table ( but you will get an alert).
Otherwise you can use the after_insert hook to run your sqlstatement and delete the actual record from your actual table. Like this you just increase your auto_increment.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: where is Save As Copy Function ??
Hi xbox,
I am - as pbötcher - not sure what you want to do.
Did you see, that in the details of your table there is a checkbox which needs to be UNchecked, so you will get a button "Save as copy"? Olaf
I am - as pbötcher - not sure what you want to do.
Did you see, that in the details of your table there is a checkbox which needs to be UNchecked, so you will get a button "Save as copy"? Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: where is Save As Copy Function ??
thanks a lot onoehring
this is Save As Copy Function
before Press Save As Copy
After Press Save As Copy
i want when press Save As copy
run sql statement to insert information into membership_users
for Ex. ( this another table ) only example
thanks a lot
this is Save As Copy Function
before Press Save As Copy
After Press Save As Copy
i want when press Save As copy
run sql statement to insert information into membership_users
for Ex. ( this another table ) only example
Code: Select all
function test_after_update($data, $memberInfo, &$args){
$memberID = $data['Name'];
$userID = sqlValue("SELECT memberID FROM membership_users where custom3 ='{$memberID}' LIMIT 1");
set_record_owner('test', $data['selectedID'], $userID);
Re: where is Save As Copy Function ??
Hi,
it seems like this is the copy function you wanted. If so, great ... but what do you want with the SQL?
I do not understand. You get the copy and the record owner should change? Isn't this done automatically?
Why does the code you provided does not work for you - if you want to set the owner of the copied record to the current person?
Sorry, so many questions. Please try to be more precise what you have, what you want to do, and what should be the result afterwards. I would think, this will help everyone.
Olaf
it seems like this is the copy function you wanted. If so, great ... but what do you want with the SQL?
I do not understand. You get the copy and the record owner should change? Isn't this done automatically?
Why does the code you provided does not work for you - if you want to set the owner of the copied record to the current person?
Sorry, so many questions. Please try to be more precise what you have, what you want to do, and what should be the result afterwards. I would think, this will help everyone.
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: where is Save As Copy Function ??
thanks for your replay
I do not understand. You get the copy and the record owner should change? Isn't this done automatically?
i want set owner for client so he can see only has record
for ex . Johnny English is client name , he have user name johnny in my app
when he login he can see has record only
also i want run other sql statement to insert the data into another table
like this
I do not understand. You get the copy and the record owner should change? Isn't this done automatically?
i want set owner for client so he can see only has record
for ex . Johnny English is client name , he have user name johnny in my app
when he login he can see has record only
also i want run other sql statement to insert the data into another table
like this
Code: Select all
sql("INSERT INTO `membership_users` set memberID='{$memberID}', passMD5='" . password_hash($password, PASSWORD_DEFAULT) . "', email='{$email}', signupDate='" . @date('Y-m-d') . "', groupID = 5, isBanned= 0, isApproved= 1 , custom1='{$Name}' , custom3='{$CustomerID}'", $eo);
Re: where is Save As Copy Function ??
Hi,
can't you use the AG built in method? Each user is in a group (or define permissions based on users - I would not recommend that).
Go to the admin area -> groups and define to your needs: The user would only be able to see his/her own records.
What is the problem "running another SQL statement"? As pbötcher described, just use the hook function you need, e.g. _after_update
Olaf
can't you use the AG built in method? Each user is in a group (or define permissions based on users - I would not recommend that).
Go to the admin area -> groups and define to your needs: The user would only be able to see his/her own records.
What is the problem "running another SQL statement"? As pbötcher described, just use the hook function you need, e.g. _after_update
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: where is Save As Copy Function ??
thnaks for your replay
i already know this one and this will set record for who create the record
but in my case
i give owner for other user ( he cannot create or update any record )
i already know this one and this will set record for who create the record
but in my case
i give owner for other user ( he cannot create or update any record )
Re: where is Save As Copy Function ??
Hi,
and what is your problem then? Just read the username of the to-be-owner and set the record owner like you suggested yourself in the after_insert. The problem I see here is, that this function is called _before_ executing the ownership insert query.
My suggestion for this is,
a) check which hook to use in the first place
b) see what is specific on the "save copy" command (from the regular save command)
c) when a copy is being executed, write something to a session variable - the new ID probably
d) get this session variable in the _init function of the table. If it's set, execute your setowner function
What I still do not understand is: Why copy a record (initiated by user X as it seems if user X can not create/edit any records)... I am not so sure, if your database design is without error, e.g. normalized.
Olaf
and what is your problem then? Just read the username of the to-be-owner and set the record owner like you suggested yourself in the after_insert. The problem I see here is, that this function is called _before_ executing the ownership insert query.
My suggestion for this is,
a) check which hook to use in the first place
b) see what is specific on the "save copy" command (from the regular save command)
c) when a copy is being executed, write something to a session variable - the new ID probably
d) get this session variable in the _init function of the table. If it's set, execute your setowner function
What I still do not understand is: Why copy a record (initiated by user X as it seems if user X can not create/edit any records)... I am not so sure, if your database design is without error, e.g. normalized.
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: where is Save As Copy Function ??
X user is customer --- he should only see record but he cannot (Add / Edit / Save ) any information this why i give he owner for has recordsWhat I still do not understand is: Why copy a record (initiated by user X as it seems if user X can not create/edit any records)... I am not so sure, if your database design is without error, e.g. normalized.
already use tablename_after_update() to insert date to other tables for run some SQL Query it work fine
but i want once user press Save As Copy App with do
1- create new record in Table
2- run some SQL Query like tablename_after_update()
** why in Hooks there is no Save As Copy Function like (( tablename_after_update() ))
thanks a lot
Re: where is Save As Copy Function ??
Hi,
** -> probably because this is simply an "insert" of a new record. Check the _after_insert function if this is used when saving a copy.
Then, you will be able to set a new owner (make sure the owner is set (=corrected to your needs) after Appgini itself set's the owner).
I still don't understand why you don't write the code to do what you want. Sorry.
Olaf
** -> probably because this is simply an "insert" of a new record. Check the _after_insert function if this is used when saving a copy.
Then, you will be able to set a new owner (make sure the owner is set (=corrected to your needs) after Appgini itself set's the owner).
I still don't understand why you don't write the code to do what you want. Sorry.
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: where is Save As Copy Function ??
hi , thanks again
_after_insert function will run MySQL Query once user press Save Now if its new record
*** Save As Copy will use _after_insert function if not new record ***
but if i add MySQL Query with _after_insert function will run MySQL Query two times
one time when press Save Now or save . and when user press Save As Copy will run MySQL Query
i have many MySQL Query want run after Save As Copy not only change owner query
_after_insert function will run MySQL Query once user press Save Now if its new record
*** Save As Copy will use _after_insert function if not new record ***
but if i add MySQL Query with _after_insert function will run MySQL Query two times
one time when press Save Now or save . and when user press Save As Copy will run MySQL Query
i have many MySQL Query want run after Save As Copy not only change owner query
Re: where is Save As Copy Function ??
Hi,
when you use the "save as Copy" button this is treated like if you would create a complete new record. So the before_insert and after_insert hooks are used.
I still do not get what you try to do and where your problem is.
when you use the "save as Copy" button this is treated like if you would create a complete new record. So the before_insert and after_insert hooks are used.
I still do not get what you try to do and where your problem is.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: where is Save As Copy Function ??
Hi xbox,
I am in line with pbötcher: I also do not understand what your problem is / what you want to do.
Olaf
I am in line with pbötcher: I also do not understand what your problem is / what you want to do.
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: where is Save As Copy Function ??
i have app there are table some information on table no change ( no need to change ) only there two record on row need to update and after update insert on new row
on this photo ,,,,, record name is not change ,,,, ( Action and mmmm ) is change
after change Action and mmmm and press Save As copy
now everything fine no problem
i want when press on Save As Copy run SOME SQL Query or send email or any other action
like we do with
tablename_after_insert
or
tablename_after_update
on this photo ,,,,, record name is not change ,,,, ( Action and mmmm ) is change
after change Action and mmmm and press Save As copy
now everything fine no problem
i want when press on Save As Copy run SOME SQL Query or send email or any other action
like we do with
tablename_after_insert
or
tablename_after_update
Re: where is Save As Copy Function ??
ok,
but still, what is your problem. When you hit "Save as Copy" the _before_insert and after_insert hooks are triggered, so you can add you code there and do what you need to do.
but still, what is your problem. When you hit "Save as Copy" the _before_insert and after_insert hooks are triggered, so you can add you code there and do what you need to do.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: where is Save As Copy Function ??
if i add code _before_insert will not working because the row already create
if i add code _after_insert will run SQl Query when press Save Now or Save and SQl Query will run also when press Save As Copy
if i add code _after_insert will run SQl Query when press Save Now or Save and SQl Query will run also when press Save As Copy
Re: where is Save As Copy Function ??
Hi,
sorry I still not get your problem. I think you missunderstand the Save as Copy feature.
This feature is meant to reduce typing of information. So you can reuse information you already entered in the form and only adopt some information.
BUT !!!
At the end it is just treated the same way as if you would enter a complete new record.
So there is NO difference if you enter a new record, or if you hit "Save as Copy".
If you would expain what you try to do it would be helpful. If you just say you want to run some SQL, why can't you just add it?
sorry I still not get your problem. I think you missunderstand the Save as Copy feature.
This feature is meant to reduce typing of information. So you can reuse information you already entered in the form and only adopt some information.
BUT !!!
At the end it is just treated the same way as if you would enter a complete new record.
So there is NO difference if you enter a new record, or if you hit "Save as Copy".
If you would expain what you try to do it would be helpful. If you just say you want to run some SQL, why can't you just add it?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: where is Save As Copy Function ??
Save as Copy function , as i know
its make copy for row and add new row in table
please check photo
you will see ID = 1 , name = Johnny English , Action = Found , Mmmm = 01/04/2020
simply i change - Action = Not Found , Mmmm = 09/04/2020
then press Save As copy
i get new row ID = 2 , name = Johnny English , Action = Not Found , Mmmm = 09/04/2020
this is very simple and there is no any problem with that .
its make copy for row and add new row in table
please check photo
you will see ID = 1 , name = Johnny English , Action = Found , Mmmm = 01/04/2020
simply i change - Action = Not Found , Mmmm = 09/04/2020
then press Save As copy
i get new row ID = 2 , name = Johnny English , Action = Not Found , Mmmm = 09/04/2020
this is very simple and there is no any problem with that .
Re: where is Save As Copy Function ??
Yes that is the meaning, but what is your question ?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: where is Save As Copy Function ??
now we understand Save As copy function
i want when press on Save As Copy ,,, run ( Some MySQL Query or Send email ) same what we do with
tablename_after_insert
or
tablename_after_update
its possible or not ????
i want when press on Save As Copy ,,, run ( Some MySQL Query or Send email ) same what we do with
tablename_after_insert
or
tablename_after_update
its possible or not ????