#!/usr/bin/perl -Ilibs
use strict;

package API::Warehouse::LabelPrinter;

use ECS::SQL;

our $Config;
BEGIN {
	use API::Config;
	$Config = $API::Config::Config;
}
use lib ($Config->{'Website_libs'});

sub setLabelPrinter {
	my $self = shift;
	my $input = shift;

	my $DBH = ECS::SQL::connect();
    my $labelPrinter = ECS::SQL::quote({'DBH' => $DBH, 'value' => $input->{'labelPrinter'}});
    my $warehouseStationID = ECS::SQL::quote({'DBH' => $DBH, 'value' => $input->{'warehouseStationID'}});
    
	my $sql = "
		UPDATE
			warehouseStation
		SET 
            tmpLabelPrinter = $labelPrinter
		WHERE
			warehouseStationID = $warehouseStationID
            AND labelPrinter != $labelPrinter";

	ECS::SQL::query({ 'DBH' => $DBH, 'sql' => $sql });

	my $response = {
		'success' => 1,
	};

	return $response;
}

