From cf9da6d87754f8ba9cd0c056cbec481b8d97d26e Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@afi-sa.fr>
Date: Sat, 12 Nov 2016 11:44:37 +0100
Subject: [PATCH] hackfest #50472 test fix

---
 VERSIONS_WIP/50472                                    | 1 +
 library/Class/WebService/SIGB/Koha/RestfulService.php | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
 create mode 100644 VERSIONS_WIP/50472

diff --git a/VERSIONS_WIP/50472 b/VERSIONS_WIP/50472
new file mode 100644
index 00000000000..19243a030a4
--- /dev/null
+++ b/VERSIONS_WIP/50472
@@ -0,0 +1 @@
+- ticket #50472 : suggestions d'achat Koha/Nanook : ajout d'un sélecteur pour le type de document
\ No newline at end of file
diff --git a/library/Class/WebService/SIGB/Koha/RestfulService.php b/library/Class/WebService/SIGB/Koha/RestfulService.php
index ed2a8fdc41f..96e5ed0b061 100644
--- a/library/Class/WebService/SIGB/Koha/RestfulService.php
+++ b/library/Class/WebService/SIGB/Koha/RestfulService.php
@@ -100,10 +100,13 @@ class Class_WebService_SIGB_Koha_RestfulService
 
 
   public function suggest($suggestion) {
-    $doctype_label = Class_TypeDoc::find($suggestion->getDocType())->getLibelle();
+    $doc_type = Class_TypeDoc::find($suggestion->getDocType());
+    $doctype_label = $doc_type
+      ? ' [' . $doc_type->getLibelle() . ']'
+      : '';
 
     $datas = ['suggestedby' => $suggestion->getUser()->getIdSigb(),
-              'title' => $suggestion->getTitle() . ' [' . $doctype_label . ']',
+              'title' => $suggestion->getTitle() . $doctype_label,
               'author' => $suggestion->getAuthor(),
               'isbn' => $suggestion->getIsbn(),
               'patronreason' => $suggestion->getPatronReason(),
-- 
GitLab