add new rule

This commit is contained in:
Frédéric FRANCE 2020-05-21 02:06:40 +02:00
parent e5fc928fda
commit ae06b35c63
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
19 changed files with 130 additions and 259 deletions

View File

@ -48,8 +48,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
else {
setEventMessages($db->lasterror(), null, 'errors');
}
}
@ -62,8 +61,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
else {
setEventMessages($db->lasterror(), null, 'errors');
}
}
@ -108,14 +106,12 @@ if ($conf->use_javascript_ajax)
{
print ajax_constantonoff('CATEGORIE_RECURSIV_ADD');
}
else
{
else {
if (empty($conf->global->CATEGORIE_RECURSIV_ADD))
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_CATEGORIE_RECURSIV_ADD">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
else
{
else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_CATEGORIE_RECURSIV_ADD">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
}
}

View File

@ -119,8 +119,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type);
exit;
}
else
{
else {
header("Location: ".DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type);
exit;
}
@ -156,8 +155,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
$action = 'confirmed';
$_POST["addcat"] = '';
}
else
{
else {
setEventMessages($object->error, $object->errors, 'errors');
}
}

View File

@ -244,8 +244,7 @@ class Categories extends DolibarrApi
{
return $this->get($id);
}
else
{
else {
throw new RestException(500, $this->category->error);
}
}

View File

@ -321,8 +321,7 @@ class Categorie extends CommonObject
{
$sql .= " WHERE ref_ext LIKE '".$this->db->escape($ref_ext)."'";
}
else
{
else {
$sql .= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category').")";
if (!is_null($type)) $sql .= " AND type = ".$this->db->escape($type);
}
@ -362,13 +361,11 @@ class Categorie extends CommonObject
return 1;
}
else
{
else {
return 0;
}
}
else
{
else {
dol_print_error($this->db);
return -1;
}
@ -483,20 +480,17 @@ class Categorie extends CommonObject
$this->db->commit();
return $id;
}
else
{
else {
$this->db->rollback();
return -3;
}
}
else
{
else {
$this->db->rollback();
return -2;
}
}
else
{
else {
$this->error = $this->db->error();
$this->db->rollback();
return -1;
@ -574,8 +568,7 @@ class Categorie extends CommonObject
return 1;
}
else
{
else {
$this->db->rollback();
dol_print_error($this->db);
return -1;
@ -661,8 +654,7 @@ class Categorie extends CommonObject
$this->db->commit();
return 1;
}
else
{
else {
$this->db->rollback();
return -1;
}
@ -722,8 +714,7 @@ class Categorie extends CommonObject
}
}
}
else
{
else {
$error++;
$this->error = $this->db->lasterror();
}
@ -748,22 +739,19 @@ class Categorie extends CommonObject
$this->db->commit();
return 1;
}
else
{
else {
$this->db->rollback();
return -2;
}
}
else
{
else {
$this->db->rollback();
if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$this->error = $this->db->lasterrno();
return -3;
}
else
{
else {
$this->error = $this->db->lasterror();
}
return -1;
@ -815,14 +803,12 @@ class Categorie extends CommonObject
$this->db->commit();
return 1;
}
else
{
else {
$this->db->rollback();
return -2;
}
}
else
{
else {
$this->db->rollback();
$this->error = $this->db->lasterror();
return -1;
@ -874,8 +860,7 @@ class Categorie extends CommonObject
{
$objs[] = $rec['fk_'.(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])];
}
else
{
else {
$obj = new $this->MAP_OBJ_CLASS[$type]($this->db);
$obj->fetch($rec['fk_'.(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])]);
$objs[] = $obj;
@ -883,8 +868,7 @@ class Categorie extends CommonObject
}
return $objs;
}
else
{
else {
$this->error = $this->db->error().' sql='.$sql;
return -1;
}
@ -1046,8 +1030,7 @@ class Categorie extends CommonObject
}
return $cats;
}
else
{
else {
dol_print_error($this->db);
return -1;
}
@ -1080,8 +1063,7 @@ class Categorie extends CommonObject
}
return 1;
}
else
{
else {
dol_print_error($this->db);
return -1;
}
@ -1124,8 +1106,7 @@ class Categorie extends CommonObject
{
$markafterid = array($markafterid);
}
else
{
else {
$markafterid = array();
}
}
@ -1166,8 +1147,7 @@ class Categorie extends CommonObject
$i++;
}
}
else
{
else {
dol_print_error($this->db);
return -1;
}
@ -1312,8 +1292,7 @@ class Categorie extends CommonObject
}
return $cats;
}
else
{
else {
dol_print_error($this->db);
return -1;
}
@ -1376,8 +1355,7 @@ class Categorie extends CommonObject
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." and same parent ".$this->fk_parent." than category id=".$this->id, LOG_DEBUG);
return 0;
}
else
{
else {
$this->error = $this->db->error();
return -1;
}
@ -1430,8 +1408,7 @@ class Categorie extends CommonObject
$linkend = '</a>';
$w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend;
}
else
{
else {
$w[] = "<a href='".DOL_URL_ROOT."/".$url."?catid=".$cat->id."'>".($addpicto ? img_object('', 'category') : '').$cat->label."</a>";
}
}
@ -1473,8 +1450,7 @@ class Categorie extends CommonObject
}
return $parents;
}
else
{
else {
dol_print_error($this->db);
return -1;
}
@ -1554,14 +1530,12 @@ class Categorie extends CommonObject
}
}
}
else
{
else {
dol_print_error($this->db);
return -1;
}
}
else
{
else {
$sql = "SELECT ct.fk_categorie, c.label, c.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type])." as ct, ".MAIN_DB_PREFIX."categorie as c";
$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".(int) $id." AND c.type = ".$this->MAP_ID[$type];
@ -1583,8 +1557,7 @@ class Categorie extends CommonObject
}
}
}
else
{
else {
dol_print_error($this->db);
return -1;
}
@ -1632,8 +1605,7 @@ class Categorie extends CommonObject
$nom = '%'.str_replace('*', '%', $nom).'%';
if (!$case)
$sql .= " AND label LIKE '".$this->db->escape($nom)."'";
else
$sql .= " AND label LIKE BINARY '".$this->db->escape($nom)."'";
else $sql .= " AND label LIKE BINARY '".$this->db->escape($nom)."'";
}
if ($id)
{
@ -1652,8 +1624,7 @@ class Categorie extends CommonObject
return $cats;
}
else
{
else {
$this->error = $this->db->error().' sql='.$sql;
return -1;
}
@ -1879,8 +1850,7 @@ class Categorie extends CommonObject
$sql2 .= " description='".$this->db->escape($this->description)."'";
$sql2 .= " WHERE fk_category=".$this->id." AND lang='".$this->db->escape($key)."'";
}
else
{
else {
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)";
$sql2 .= " VALUES(".$this->id.",'".$key."','".$this->db->escape($this->label);
$sql2 .= "','".$this->db->escape($this->multilangs["$key"]["description"])."')";
@ -1901,8 +1871,7 @@ class Categorie extends CommonObject
$sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'";
$sql2 .= " WHERE fk_category=".$this->id." AND lang='".$this->db->escape($key)."'";
}
else
{
else {
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)";
$sql2 .= " VALUES(".$this->id.",'".$key."','".$this->db->escape($this->multilangs["$key"]["label"]);
$sql2 .= "','".$this->db->escape($this->multilangs["$key"]["description"])."')";
@ -1961,8 +1930,7 @@ class Categorie extends CommonObject
}
return 1;
}
else
{
else {
$this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql;
return -1;
}
@ -2067,8 +2035,7 @@ class Categorie extends CommonObject
{
return " AND (".implode(' AND ', $searchCategorySqlList).")";
}
else
{
else {
return "";
}
}

View File

@ -90,8 +90,7 @@ if ($action == 'update' && $user->rights->categorie->creer)
if ($parent != "-1")
$object->fk_parent = $parent;
else
$object->fk_parent = "";
else $object->fk_parent = "";
if (empty($object->label))
@ -110,13 +109,11 @@ if ($action == 'update' && $user->rights->categorie->creer)
header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type);
exit;
}
else
{
else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
{
else {
setEventMessages($object->error, $object->errors, 'errors');
}
}

View File

@ -54,7 +54,7 @@ $typetext = $type;
if ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans('AccountsCategoriesArea');
elseif ($type == Categorie::TYPE_WAREHOUSE) $title = $langs->trans('StocksCategoriesArea');
elseif ($type == Categorie::TYPE_ACTIONCOMM) $title = $langs->trans('ActionCommCategoriesArea');
else $title = $langs->trans(ucfirst($type).'sCategoriesArea');
else $title = $langs->trans(ucfirst($type).'sCategoriesArea');
$arrayofjs = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
$arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
@ -207,8 +207,7 @@ if ($nbofentries > 0)
tree_recur($data, $data[0], 0);
print '</td></tr>';
}
else
{
else {
print '<tr class="pair">';
print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>';
print '<td valign="middle">';

View File

@ -180,8 +180,7 @@ if ($object->id)
print '<a class="butAction hideonsmartphone" href="'.$_SERVER['PHP_SELF'].'?action=ajout_photo&amp;id='.$object->id.'&amp;type='.$type.'">';
print $langs->trans("AddPhoto").'</a>';
}
else
{
else {
print '<a class="butActionRefused classfortooltip hideonsmartphone" href="#">';
print $langs->trans("AddPhoto").'</a>';
}
@ -232,8 +231,7 @@ if ($object->id)
{
$filename = $obj['photo_vignette'];
}
else
{
else {
$filename = $obj['photo'];
}
@ -281,8 +279,7 @@ if ($object->id)
}
}
}
else
{
else {
print $langs->trans("ErrorUnknown");
}

View File

@ -162,8 +162,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
header("Location: ".DOL_URL_ROOT.'/categories/index.php?type='.$type);
exit;
}
else
{
else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -181,14 +180,12 @@ if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory'
{
setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs');
}
else
{
else {
if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
}
else
{
else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -337,8 +334,7 @@ elseif (count($cats) < 1)
print '<td colspan="3" class="opacitymedium">'.$langs->trans("NoSubCat").'</td>';
print '</tr>';
}
else
{
else {
$categstatic = new Categorie($db);
$fulltree = $categstatic->get_full_arbo($type, $object->id, 1);
@ -408,8 +404,7 @@ else
print '</td>';
print '</tr>';
}
else
{
else {
print '<tr class="pair">';
print '<td colspan="3">';
print '<table class="nobordernopadding">';
@ -451,8 +446,7 @@ if ($type == Categorie::TYPE_PRODUCT)
{
dol_print_error($db, $prods->error, $prods->errors);
}
else
{
else {
// Form to add record into a category
$showclassifyform = 1;
if ($showclassifyform)
@ -515,8 +509,7 @@ if ($type == Categorie::TYPE_PRODUCT)
print "</tr>\n";
}
}
else
{
else {
print '<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
}
print "</table>\n";
@ -534,8 +527,7 @@ if ($type == Categorie::TYPE_SUPPLIER)
{
dol_print_error($db, $socs->error, $socs->errors);
}
else
{
else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -576,8 +568,7 @@ if ($type == Categorie::TYPE_SUPPLIER)
print "</tr>\n";
}
}
else
{
else {
print '<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
}
print "</table>\n";
@ -595,8 +586,7 @@ if ($type == Categorie::TYPE_CUSTOMER)
{
dol_print_error($db, $socs->error, $socs->errors);
}
else
{
else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -636,8 +626,7 @@ if ($type == Categorie::TYPE_CUSTOMER)
print "</tr>\n";
}
}
else
{
else {
print '<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
}
print "</table>\n";
@ -658,8 +647,7 @@ if ($type == Categorie::TYPE_MEMBER)
{
dol_print_error($db, $prods->error, $prods->errors);
}
else
{
else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -701,8 +689,7 @@ if ($type == Categorie::TYPE_MEMBER)
print "</tr>\n";
}
}
else
{
else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
}
print "</table>\n";
@ -721,8 +708,7 @@ if ($type == Categorie::TYPE_CONTACT)
{
dol_print_error($db, $contacts->error, $contacts->errors);
}
else
{
else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -765,8 +751,7 @@ if ($type == Categorie::TYPE_CONTACT)
print "</tr>\n";
}
}
else
{
else {
print '<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
}
print "</table>\n";
@ -787,8 +772,7 @@ if ($type == Categorie::TYPE_ACCOUNT)
{
dol_print_error($db, $accounts->error, $accounts->errors);
}
else
{
else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -829,8 +813,7 @@ if ($type == Categorie::TYPE_ACCOUNT)
print "</tr>\n";
}
}
else
{
else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
}
print "</table>\n";
@ -851,8 +834,7 @@ if ($type == Categorie::TYPE_PROJECT)
{
dol_print_error($db, $object->error, $object->errors);
}
else
{
else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -894,8 +876,7 @@ if ($type == Categorie::TYPE_PROJECT)
print "</tr>\n";
}
}
else
{
else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
}
print "</table>\n";
@ -914,8 +895,7 @@ if ($type == Categorie::TYPE_USER)
{
dol_print_error($db, $object->error, $object->errors);
}
else
{
else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -954,8 +934,7 @@ if ($type == Categorie::TYPE_USER)
print "</tr>\n";
}
}
else
{
else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
}
print "</table>\n";
@ -977,8 +956,7 @@ if ($type == Categorie::TYPE_WAREHOUSE)
{
dol_print_error($db, $object->error, $object->errors);
}
else
{
else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -1020,8 +998,7 @@ if ($type == Categorie::TYPE_WAREHOUSE)
print "</tr>\n";
}
}
else
{
else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
}
print "</table>\n";

View File

@ -95,8 +95,7 @@ if ($action == 'add')
setEventMessages($langs->trans("PageAdded", $objectpage->pageurl), null, 'mesgs');
$action = '';
}
else
{
else {
$db->rollback();
}
@ -130,13 +129,11 @@ if ($action == 'delete')
header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website);
exit;
}
else
{
else {
$db->rollback();
}
}
else
{
else {
dol_print_error($db);
}
}

View File

@ -71,14 +71,12 @@ if ($action == 'specimen')
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=donation&file=SPECIMEN.html");
return;
}
else
{
else {
setEventMessages($obj->error, $obj->errors, 'errors');
dol_syslog($obj->error, LOG_ERR);
}
}
else
{
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
@ -130,8 +128,7 @@ if ($action == 'set_DONATION_ACCOUNTINGACCOUNT')
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -148,8 +145,7 @@ if ($action == 'set_DONATION_MESSAGE')
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -165,8 +161,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
else {
dol_print_error($db);
}
}
@ -179,8 +174,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
else {
dol_print_error($db);
}
}
@ -223,8 +217,7 @@ if ($resql)
$i++;
}
}
else
{
else {
dol_print_error($db);
}
@ -276,15 +269,13 @@ if (is_resource($handle))
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</td>';
}
else
{
else {
print "<td class=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
print '</td>';
}
}
else
{
else {
print "<td class=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
@ -297,8 +288,7 @@ if (is_resource($handle))
print img_picto($langs->trans("Default"), 'on');
print '</td>';
}
else
{
else {
print "<td class=\"center\">";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
print '</td>';
@ -371,8 +361,7 @@ if (!empty($conf->accounting->enabled))
{
print $formaccounting->select_account($conf->global->DONATION_ACCOUNTINGACCOUNT, 'DONATION_ACCOUNTINGACCOUNT', 1, '', 1, 1);
}
else
{
else {
print '<input type="text" size="10" id="DONATION_ACCOUNTINGACCOUNT" name="DONATION_ACCOUNTINGACCOUNT" value="'.$conf->global->DONATION_ACCOUNTINGACCOUNT.'">';
}
print '</td><td class="center">';

View File

@ -181,8 +181,7 @@ if ($action == 'add')
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
exit;
}
else
{
else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -196,8 +195,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights-
header("Location: index.php");
exit;
}
else
{
else {
dol_syslog($object->error, LOG_DEBUG);
setEventMessages($object->error, $object->errors, 'errors');
}
@ -355,8 +353,7 @@ if ($action == 'create')
print ')';
print '</td>';
}
else
{
else {
print '<td colspan="2">';
print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
// Option to reload page to retrieve customer informations. Note, this clear other input
@ -520,8 +517,7 @@ if (!empty($id) && $action == 'edit')
{
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.price($object->amount).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
else
{
else {
print '<tr><td>'.$langs->trans("Amount").'</td><td>';
print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
print '</td></tr>';
@ -777,8 +773,7 @@ if (!empty($id) && $action != 'edit')
print "</table>";
$db->free($resql);
}
else
{
else {
dol_print_error($db);
}
@ -815,8 +810,7 @@ if (!empty($id) && $action != 'edit')
{
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</span></div>';
}
else
{
else {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/payment/payment.php?rowid='.$object->id.'&amp;action=create">'.$langs->trans('DoPayment').'</a></div>';
}
}
@ -834,13 +828,11 @@ if (!empty($id) && $action != 'edit')
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
}
else
{
else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
}
}
else
{
else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
}

View File

@ -231,8 +231,7 @@ class Donations extends DolibarrApi
{
return $this->get($id);
}
else
{
else {
throw new RestException(500, $this->don->error);
}
}

View File

@ -315,8 +315,7 @@ class Don extends CommonObject
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Amount'));
$err++;
}
else
{
else {
if ($this->amount < $minimum && $minimum > 0)
{
$error_string[] = $langs->trans('MinimumAmount', $langs->transnoentitiesnoconv('$minimum'));
@ -330,8 +329,7 @@ class Don extends CommonObject
$this->errors = $error_string;
return 0;
}
else
{
else {
return 1;
}
}
@ -423,8 +421,7 @@ class Don extends CommonObject
// End call triggers
}
}
else
{
else {
$this->error = $this->db->lasterror();
$this->errno = $this->db->lasterrno();
$error++;
@ -453,8 +450,7 @@ class Don extends CommonObject
$this->db->commit();
return $ret;
}
else
{
else {
$this->db->rollback();
return -1;
}
@ -534,14 +530,12 @@ class Don extends CommonObject
$this->db->commit();
$result = 1;
}
else
{
else {
$this->db->rollback();
$result = -1;
}
}
else
{
else {
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
$this->db->rollback();
@ -613,8 +607,7 @@ class Don extends CommonObject
$this->db->commit();
return 1;
}
else
{
else {
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
@ -709,8 +702,7 @@ class Don extends CommonObject
}
return 1;
}
else
{
else {
dol_print_error($this->db);
return -1;
}
@ -762,8 +754,7 @@ class Don extends CommonObject
}
}
}
else
{
else {
$error++;
$this->error = $this->db->lasterror();
}
@ -773,8 +764,7 @@ class Don extends CommonObject
$this->db->commit();
return 1;
}
else
{
else {
$this->db->rollback();
return -1;
}
@ -805,13 +795,11 @@ class Don extends CommonObject
{
return 1;
}
else
{
else {
return 0;
}
}
else
{
else {
dol_print_error($this->db);
return -1;
}
@ -836,13 +824,11 @@ class Don extends CommonObject
{
return 1;
}
else
{
else {
return 0;
}
}
else
{
else {
dol_print_error($this->db);
return -1;
}
@ -905,8 +891,7 @@ class Don extends CommonObject
$this->db->free($resql);
return 1;
}
else
{
else {
dol_print_error($this->db);
$this->error = $this->db->error();
return -1;
@ -991,8 +976,7 @@ class Don extends CommonObject
}
$this->db->free($result);
}
else
{
else {
dol_print_error($this->db);
}
}
@ -1089,16 +1073,14 @@ class Don extends CommonObject
dol_delete_preview($object);
return 1;
}
else
{
else {
$outputlangs->charset_output = $sav_charset_output;
dol_syslog("Erreur dans don_create");
dol_print_error($this->db, $obj->error);
return 0;
}
}
else
{
else {
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file);
return 0;
}

View File

@ -168,8 +168,7 @@ class PaymentDonation extends CommonObject
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_donation");
$this->ref = $this->id;
}
else
{
else {
$error++;
}
}
@ -189,8 +188,7 @@ class PaymentDonation extends CommonObject
$this->db->commit();
return $this->id;
}
else
{
else {
$this->error = $this->db->error();
$this->db->rollback();
return -1;
@ -259,8 +257,7 @@ class PaymentDonation extends CommonObject
return 1;
}
else
{
else {
$this->error = "Error ".$this->db->lasterror();
return -1;
}
@ -342,8 +339,7 @@ class PaymentDonation extends CommonObject
$this->db->rollback();
return -1 * $error;
}
else
{
else {
$this->db->commit();
return 1;
}
@ -412,8 +408,7 @@ class PaymentDonation extends CommonObject
$this->db->rollback();
return -1 * $error;
}
else
{
else {
$this->db->commit();
return 1;
}
@ -467,8 +462,7 @@ class PaymentDonation extends CommonObject
$this->db->commit();
return $object->id;
}
else
{
else {
$this->db->rollback();
return -1;
}
@ -593,8 +587,7 @@ class PaymentDonation extends CommonObject
}
}
}
else
{
else {
$this->error = $acc->error;
$error++;
}
@ -604,8 +597,7 @@ class PaymentDonation extends CommonObject
{
return 1;
}
else
{
else {
return -1;
}
}
@ -629,8 +621,7 @@ class PaymentDonation extends CommonObject
{
return 1;
}
else
{
else {
$this->error = $this->db->error();
return 0;
}

View File

@ -187,8 +187,7 @@ if ($object->id)
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
}
else
{
else {
print $langs->trans("ErrorUnknown");
}

View File

@ -284,8 +284,7 @@ if ($resql)
print "</form>\n";
$db->free($resql);
}
else
{
else {
dol_print_error($db);
}

View File

@ -64,8 +64,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->don->supp
header("Location: ".DOL_URL_ROOT."/don/index.php");
exit;
}
else
{
else {
setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
}
@ -102,8 +101,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->don->cree
header('Location: card.php?id='.$object->id);
exit;
}
else
{
else {
setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
}
@ -254,8 +252,7 @@ if ($resql)
print "</table>\n";
$db->free($resql);
}
else
{
else {
dol_print_error($db);
}
@ -290,8 +287,7 @@ if (empty($action))
{
print '<a class="butActionDelete" href="card.php?id='.$_GET['id'].'&amp;action=delete">'.$langs->trans('Delete').'</a>';
}
else
{
else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentWithOneInvoicePaid")).'">'.$langs->trans('Delete').'</a>';
}
}

View File

@ -138,8 +138,7 @@ if ($action == 'add_payment')
header('Location: '.$loc);
exit;
}
else
{
else {
$db->rollback();
}
}
@ -261,8 +260,7 @@ if ($action == 'create')
$namef = "amount_".$objp->id;
print '<input type="text" size="8" name="'.$namef.'">';
}
else
{
else {
print '-';
}
print "</td>";

View File

@ -76,8 +76,7 @@ if (!$user->rights->societe->client->voir || $user->socid)
{
$filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png';
}
else
{
else {
$filenamenb = $dir.'/shipmentsnbinyear-'.$year.'.png';
}