1 |
fraynaud |
358 |
<?php |
2 |
|
|
/** |
3 |
|
|
* ce script a pour objet de recuperer |
4 |
|
|
* evenement + bible associƩ |
5 |
|
|
* @package openmairie_exemple |
6 |
fmichon |
1184 |
* @version SVN : $Id$ |
7 |
fraynaud |
358 |
*/ |
8 |
|
|
$DEBUG=1; |
9 |
|
|
require_once "../obj/utils.class.php"; |
10 |
|
|
|
11 |
|
|
// Identifiant de l'objet metier a copier |
12 |
|
|
(isset($_GET['idx']) ? $idx = $_GET['idx'] : $idx = ""); |
13 |
|
|
// Nom de l'objet metier |
14 |
|
|
(isset($_GET['obj']) ? $obj = $_GET['obj'] : $obj = ""); |
15 |
|
|
// Nom de l'objet metier associe |
16 |
|
|
(isset($_GET['objsf']) ? $objsf = $_GET['objsf'] : $objsf = ""); |
17 |
|
|
|
18 |
|
|
|
19 |
|
|
$f = new utils(NULL, "copie", _("copie"), "copie.png", |
20 |
|
|
$obj); |
21 |
|
|
|
22 |
|
|
echo "\n<br> "; |
23 |
|
|
echo "<fieldset>\n"; |
24 |
|
|
echo "\t<legend>"._("Copie ")."</legend>"; |
25 |
|
|
$f->setRight($obj); |
26 |
|
|
$f->isAuthorized(); |
27 |
|
|
$sql="select * from ".DB_PREFIXE.$obj." where ".$obj."=".$idx; |
28 |
|
|
// clone |
29 |
|
|
$res = $f->db->query($sql); |
30 |
|
|
$f->isDatabaseError($res); |
31 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
32 |
|
|
$valF=$row; |
33 |
|
|
} |
34 |
|
|
// valeurs non clonees |
35 |
|
|
$valF['libelle']= 'copie '.$idx.' du '.date('d/m/Y'); |
36 |
|
|
$valF[$obj]=$f-> db -> nextId(DB_PREFIXE.$obj); |
37 |
|
|
$res1= $f-> db -> autoExecute(DB_PREFIXE.$obj,$valF,DB_AUTOQUERY_INSERT); |
38 |
|
|
$f->isDatabaseError($res1); |
39 |
|
|
echo $obj." "._("importe")." no ".$idx." : ".$valF[$obj]; |
40 |
|
|
// objet associe |
41 |
|
|
$sql="select * from ".DB_PREFIXE.$objsf." where ".$obj."=".$idx; |
42 |
|
|
// clone |
43 |
|
|
$id=$valF[$obj]; // archive de l id |
44 |
|
|
$res2 = $f->db->query($sql); |
45 |
|
|
$f->isDatabaseError($res2); |
46 |
|
|
while ($row=& $res2->fetchRow(DB_FETCHMODE_ASSOC)) { |
47 |
|
|
$valF=$row; |
48 |
|
|
$valF[$obj]=$id; |
49 |
|
|
$valF[$objsf]=$f-> db -> nextId(DB_PREFIXE.$objsf); |
50 |
|
|
$res3= $f-> db -> autoExecute(DB_PREFIXE.$objsf,$valF,DB_AUTOQUERY_INSERT); |
51 |
|
|
$f->isDatabaseError($res3); |
52 |
|
|
echo "<br>".$objsf." "._("importe")." no ".$valF[$objsf]." ".$id ; |
53 |
|
|
} |
54 |
|
|
echo "</fieldset>"; |
55 |
|
|
?> |