Commit f7fffd20 authored by Denis Bonnenfant's avatar Denis Bonnenfant
Browse files

correction bug drivers (2)

parent 3a89b4fe
sambaedu (4.2.16) UNRELEASED; urgency=medium
sambaedu (4.2.18) UNRELEASED; urgency=medium
[ Denis Bonnenfant ]
* Nouvelle version stable
-- Denis Bonnenfant <denis.bonnenfant@sambaedu.org> Wed, 20 Jan 2021 20:58:51 +0100
-- Denis Bonnenfant <denis.bonnenfant@sambaedu.org> Wed, 20 Jan 2021 21:38:42 +0100
sambaedu (4.0.443) UNRELEASED; urgency=medium
......
......@@ -130,9 +130,10 @@ function add_printer($config, string $nom, string $url = "", string $description
$message = array();
$commande = "sudo lpadmin -p " . escapeshellarg($nom) . $options;
$ret = 1;
exec($commande, $message, $ret);
exec($commande, $message, $ret);
if ($ret == 0) {
exec("sudo smbcontrol smbd reload-printers");
if (! empty($driver))
set_smb_driver($config, $nom, $driver);
return true;
......
......@@ -93,9 +93,9 @@ if (empty($nom) && ! $new) {
echo "<INPUT TYPE=\"hidden\" NAME=\"new\" VALUE=\"true\">\n";
echo "<INPUT TYPE=\"submit\" VALUE=\"Ajouter\" NAME=\"ajouter\">\n";
echo "</FORM>\n";
} elseif (empty($nom) || empty($uri) || empty($driver) || empty($info)) {
} elseif (empty($nom) || empty($uri) || empty($info)) {
echo "<H1>" . gettext("Configuration de l'imprimante") . "</H1>\n";
$smb_ready = false;
if (! empty($nom)) {
$printer_exist = list_printers($config, $nom, false);
if (count($printer_exist) == 1) {
......@@ -103,6 +103,7 @@ if (empty($nom) && ! $new) {
$info = $printer_exist[0]['description'];
$lieu = $printer_exist[0]['location'];
$driver = $printer_exist[0]['smb_driver'];
$smb_ready = $printer_exist[0]['smb_ready'];
}
}
// Affichage du formulaire
......@@ -141,9 +142,10 @@ if (empty($nom) && ! $new) {
echo "<TR>\n";
echo "<TD>" . gettext("Pilote Windows") . " :</TD>\n";
echo "<TD COLSPAN=\"2\" VALIGN=\"top\">";
if (! $printer_exist[0]['smb_ready']) {
if (! $smb_ready) {
$control = "disabled";
$texte = "Attention l'imprimante n'est pas encore prête, veuillez patienter pour choisir le pilote<br>";
$driver = "Attente...";
} else {
$control = "";
$texte = "";
......@@ -151,9 +153,10 @@ if (empty($nom) && ! $new) {
echo "<SELECT NAME=\"driver\" SIZE=\"1\" " . $control . ">\n";
$drivers = array_merge(list_smb_drivers($config), array(
"Aucun (impression Linux uniquement)"
"Aucun (impression Linux uniquement)",
"Attente..."
));
$driver = $driver ?? "Aucun (impression Linux uniquement)";
// $driver = $driver ?? "Aucun (impression Linux uniquement)";
foreach ($drivers as $d) {
echo "<OPTION VALUE=\"$d\"";
if ($d == $driver)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment