Fix: Can't enable document for supplier invoice/order
This commit is contained in:
parent
e426172c47
commit
c8013ac699
@ -132,10 +132,12 @@ if ($_GET["action"] == 'specimenfacture') // For invoices
|
||||
if ($_GET["action"] == 'set')
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES ('".$_GET["value"]."','".$_GET["type"]."',".$conf->entity.")";
|
||||
if ($db->query($sql))
|
||||
$res=$db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'del')
|
||||
@ -144,10 +146,12 @@ if ($_GET["action"] == 'del')
|
||||
$sql.= " WHERE nom = '".$_GET["value"]."'";
|
||||
$sql.= " AND type = '".$_GET["type"]."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
if ($db->query($sql))
|
||||
$db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'setdoc')
|
||||
@ -348,7 +352,7 @@ print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
|
||||
print '<td>'.$langs->trans("Description").'</td>'."\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>'."\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Default").'</td>'."\n";
|
||||
print '<td align="center" width="32" colspan="2">'.$langs->trans("Info").'</td>';
|
||||
print '<td align="center" width="40" colspan="2">'.$langs->trans("Info").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
clearstatcache();
|
||||
@ -366,8 +370,9 @@ if (is_resource($handle))
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">\n <td>$name";
|
||||
print "</td>\n <td>\n";
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
print "<td>".$name."</td>\n";
|
||||
print "<td>\n";
|
||||
require_once($dir.$file);
|
||||
$module = new $classname($db,$specimenthirdparty);
|
||||
print $module->description;
|
||||
@ -379,7 +384,7 @@ if (is_resource($handle))
|
||||
print '<td align="center">'."\n";
|
||||
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name")
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&type=supplier_order">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&type=order_supplier">';
|
||||
print img_picto($langs->trans("Enabled"),'on');
|
||||
print '</a>';
|
||||
}
|
||||
@ -392,7 +397,7 @@ if (is_resource($handle))
|
||||
else
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&type=supplier_order">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&type=order_supplier">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -404,7 +409,7 @@ if (is_resource($handle))
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&type=supplier_order"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'on').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'on').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -472,7 +477,7 @@ print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
|
||||
print '<td>'.$langs->trans("Description").'</td>'."\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>'."\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Default").'</td>'."\n";
|
||||
print '<td align="center" width="32" colspan="2">'.$langs->trans("Info").'</td>';
|
||||
print '<td align="center" width="40" colspan="2">'.$langs->trans("Info").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
clearstatcache();
|
||||
@ -489,8 +494,9 @@ if (is_resource($handle))
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">\n <td>$name";
|
||||
print "</td>\n <td>\n";
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
print "<td>".$name."</td>\n";
|
||||
print "<td>";
|
||||
require_once($dir.$file);
|
||||
$module = new $classname($db,$specimenthirdparty);
|
||||
print $module->description;
|
||||
@ -502,7 +508,7 @@ if (is_resource($handle))
|
||||
print "<td align=\"center\">\n";
|
||||
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&type=supplier_invoice">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&type=invoice_supplier">';
|
||||
print img_picto($langs->trans("Enabled"),'on');
|
||||
print '</a>';
|
||||
}
|
||||
@ -515,7 +521,7 @@ if (is_resource($handle))
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&type=supplier_invoice">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -527,7 +533,7 @@ if (is_resource($handle))
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&type=supplier_invoice" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'on').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&type=invoice_supplier" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'on').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -470,8 +470,8 @@ class FormMail
|
||||
if ($this->param["models"]=='facture_relance') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }
|
||||
if ($this->param["models"]=='propal_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendProposal"); }
|
||||
if ($this->param["models"]=='order_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrder"); }
|
||||
if ($this->param["models"]=='supplier_order_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierOrder"); }
|
||||
if ($this->param["models"]=='supplier_facture_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierInvoice"); }
|
||||
if ($this->param["models"]=='order_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierOrder"); }
|
||||
if ($this->param["models"]=='invoice_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierInvoice"); }
|
||||
$defaultmessage=make_substitutions($defaultmessage,$this->substit,$langs);
|
||||
if (isset($_POST["message"])) $defaultmessage=$_POST["message"];
|
||||
$defaultmessage=str_replace('\n',"\n",$defaultmessage);
|
||||
|
||||
@ -1466,7 +1466,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$formmail->substit['__ORDERREF__']=$commande->ref;
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action']='send';
|
||||
$formmail->param['models']='supplier_order_send';
|
||||
$formmail->param['models']='order_supplier_send';
|
||||
$formmail->param['orderid']=$commande->id;
|
||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$commande->id;
|
||||
|
||||
|
||||
@ -1859,7 +1859,7 @@ else
|
||||
$formmail->substit['__FACREF__']=$fac->ref;
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action']='send';
|
||||
$formmail->param['models']='supplier_facture_send';
|
||||
$formmail->param['models']='invoice_supplier_send';
|
||||
$formmail->param['facid']=$fac->id;
|
||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?facid='.$fac->id;
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ class modFournisseur extends DolibarrModules
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "mod_commande_fournisseur_muguet";
|
||||
$r++;
|
||||
|
||||
|
||||
$this->const[$r][0] = "INVOICE_SUPPLIER_ADDON_PDF";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "canelle";
|
||||
@ -207,7 +207,7 @@ class modFournisseur extends DolibarrModules
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'facture';
|
||||
$this->rights[$r][5] = 'supprimer';
|
||||
|
||||
|
||||
$this->rights[$r][0] = 1235;
|
||||
$this->rights[$r][1] = 'Envoyer les factures par mail';
|
||||
$this->rights[$r][2] = 'a';
|
||||
@ -273,7 +273,7 @@ class modFournisseur extends DolibarrModules
|
||||
|
||||
$sql = array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','supplier_order',".$conf->entity.")",
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','order_supplier',".$conf->entity.")",
|
||||
);
|
||||
|
||||
$this->load_datas();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user