64 $sourcetable = $sourcetype;
65 $targettable = $targettype;
67 if ($sourcetype ==
'shipping') {
68 $sourcetable =
'expedition';
69 } elseif ($targettype ==
'shipping') {
70 $targettable =
'expedition';
72 if ($sourcetype ==
'delivery') {
73 $sourcetable =
'livraison';
74 } elseif ($targettype ==
'delivery') {
75 $targettable =
'livraison';
77 if ($sourcetype ==
'order_supplier') {
78 $sourcetable =
'commande_fournisseur';
79 } elseif ($targettype ==
'order_supplier') {
80 $targettable =
'commande_fournisseur';
82 if ($sourcetype ==
'invoice_supplier') {
83 $sourcetable =
'facture_fourn';
84 } elseif ($targettype ==
'invoice_supplier') {
85 $targettable =
'facture_fourn';
88 $out = $langs->trans(
'SourceType').
': '.$sourcetype.
' => '.$langs->trans(
'TargetType').
': '.$targettype.
' ';
90 $sql =
"SELECT rowid, fk_source, fk_target FROM ".MAIN_DB_PREFIX.
"element_element";
91 $sql .=
" WHERE sourcetype = '".$db->escape($sourcetype).
"' AND targettype = '".$db->escape($targettype).
"'";
92 $resql = $db->query($sql);
94 $num = $db->num_rows($resql);
98 $obj = $db->fetch_object($resql);
99 $elements[$obj->rowid] = array($sourcetype => $obj->fk_source, $targettype => $obj->fk_target);
105 if (!empty($elements)) {
106 foreach ($elements as $key => $element) {
108 $sql =
'DELETE FROM '.MAIN_DB_PREFIX.
'element_element';
109 $sql .=
" WHERE rowid = ".((int) $key);
110 $resql = $db->query($sql);
117 $out .=
'('.$langs->trans(
'LinkedElementsInvalidDeleted', $deleted).
')<br>';
119 $out .=
'('.$langs->trans(
'NothingToDelete').
')<br>';
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...